bug 839034 - move markPageAsXXX methods to nsINavHistoryService r=mak sr=gavin

This commit is contained in:
Raymond Lee 2013-02-27 10:54:09 +08:00
parent 5eb04bf66b
commit 8c95503498
8 changed files with 26 additions and 33 deletions

View File

@ -399,8 +399,7 @@ this.PlacesUIUtils = {
* TRANSITION_LINK.
*/
markPageAsTyped: function PUIU_markPageAsTyped(aURL) {
PlacesUtils.history.QueryInterface(Ci.nsIBrowserHistory)
.markPageAsTyped(this.createFixedURI(aURL));
PlacesUtils.history.markPageAsTyped(this.createFixedURI(aURL));
},
/**
@ -421,8 +420,7 @@ this.PlacesUIUtils = {
* so automatic visits can be correctly ignored.
*/
markPageAsFollowedLink: function PUIU_markPageAsFollowedLink(aURL) {
PlacesUtils.history.QueryInterface(Ci.nsIBrowserHistory)
.markPageAsFollowedLink(this.createFixedURI(aURL));
PlacesUtils.history.markPageAsFollowedLink(this.createFixedURI(aURL));
},
/**

View File

@ -124,7 +124,7 @@ XPCOMUtils.defineLazyGetter(this, "ZoomManager", function() {
return sandbox.ZoomManager;
});
XPCOMUtils.defineLazyServiceGetter(window, "gHistSvc", "@mozilla.org/browser/nav-history-service;1", "nsINavHistoryService", "nsIBrowserHistory");
XPCOMUtils.defineLazyServiceGetter(window, "gHistSvc", "@mozilla.org/browser/nav-history-service;1", "nsINavHistoryService");
XPCOMUtils.defineLazyServiceGetter(window, "gURIFixup", "@mozilla.org/docshell/urifixup;1", "nsIURIFixup");
XPCOMUtils.defineLazyServiceGetter(window, "gFaviconService", "@mozilla.org/browser/favicon-service;1", "nsIFaviconService");
XPCOMUtils.defineLazyServiceGetter(window, "gFocusManager", "@mozilla.org/focus-manager;1", "nsIFocusManager");

View File

@ -10,7 +10,7 @@
#include "nsISupports.idl"
#include "nsIGlobalHistory2.idl"
[scriptable, uuid(d176f8e8-383f-4109-812d-cce015e2d804)]
[scriptable, uuid(837ea2db-c4c7-4f4c-8982-6c8c73e8f5d3)]
interface nsIBrowserHistory : nsIGlobalHistory2
{
/**
@ -93,21 +93,4 @@ interface nsIBrowserHistory : nsIGlobalHistory2
* nsINavHistoryObserver implementers.
*/
void removeAllPages();
/**
* Designates the url as having been explicitly typed in by the user.
*
* @param aURI
* URI of the page to be marked.
*/
void markPageAsTyped(in nsIURI aURI);
/**
* Designates the url as coming from a link explicitly followed by
* the user (for example by clicking on it).
*
* @param aURI
* URI of the page to be marked.
*/
void markPageAsFollowedLink(in nsIURI aURI);
};

View File

@ -1157,7 +1157,7 @@ interface nsINavHistoryQueryOptions : nsISupports
nsINavHistoryQueryOptions clone();
};
[scriptable, uuid(562e698d-04f0-4df1-bd5d-1f1e5b84d7ef)]
[scriptable, uuid(03316279-5ee2-4f67-861e-621578e7bc82)]
interface nsINavHistoryService : nsISupports
{
/**
@ -1266,6 +1266,23 @@ interface nsINavHistoryService : nsISupports
*/
void markPageAsFollowedBookmark(in nsIURI aURI);
/**
* Designates the url as having been explicitly typed in by the user.
*
* @param aURI
* URI of the page to be marked.
*/
void markPageAsTyped(in nsIURI aURI);
/**
* Designates the url as coming from a link explicitly followed by
* the user (for example by clicking on it).
*
* @param aURI
* URI of the page to be marked.
*/
void markPageAsFollowedLink(in nsIURI aURI);
/**
* Gets the stored character-set for an URI.
*

View File

@ -5,7 +5,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "places_test_harness.h"
#include "nsIBrowserHistory.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "mozilla/Attributes.h"
@ -512,12 +511,11 @@ void
test_visituri_transition_typed()
{
nsCOMPtr<nsINavHistoryService> navHistory = do_get_NavHistory();
nsCOMPtr<nsIBrowserHistory> browserHistory = do_QueryInterface(navHistory);
nsCOMPtr<IHistory> history = do_get_IHistory();
nsCOMPtr<nsIURI> lastURI = new_test_uri();
nsCOMPtr<nsIURI> visitedURI = new_test_uri();
browserHistory->MarkPageAsTyped(visitedURI);
navHistory->MarkPageAsTyped(visitedURI);
history->VisitURI(visitedURI, lastURI, mozilla::IHistory::TOP_LEVEL);
nsRefPtr<VisitURIObserver> finisher = new VisitURIObserver();
finisher->WaitForNotification();
@ -535,8 +533,6 @@ test_visituri_transition_typed()
void
test_visituri_transition_embed()
{
nsCOMPtr<nsINavHistoryService> navHistory = do_get_NavHistory();
nsCOMPtr<nsIBrowserHistory> browserHistory = do_QueryInterface(navHistory);
nsCOMPtr<IHistory> history = do_get_IHistory();
nsCOMPtr<nsIURI> lastURI = new_test_uri();
nsCOMPtr<nsIURI> visitedURI = new_test_uri();

View File

@ -23,7 +23,7 @@
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
addVisits(typedURI, function() {
bhist.markPageAsTyped(typedURI);
histsvc.markPageAsTyped(typedURI);
var clickedLinkChannel = ios.newChannelFromURI(clickedLinkURI);
clickedLinkChannel.QueryInterface(Ci.nsIHttpChannel).referrer = typedURI;

View File

@ -119,7 +119,7 @@ function task_populateDB(aArray)
var qdata = new queryData(data);
if (qdata.markPageAsTyped) {
PlacesUtils.bhistory.markPageAsTyped(uri(qdata.uri));
PlacesUtils.history.markPageAsTyped(uri(qdata.uri));
}
if (qdata.isPageAnnotation) {

View File

@ -18,7 +18,6 @@ Autocomplete Frecency Tests
try {
var histsvc = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
var bhist = histsvc.QueryInterface(Ci.nsIBrowserHistory);
var bmsvc = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Ci.nsINavBookmarksService);
var prefs = Cc["@mozilla.org/preferences-service;1"].
@ -96,7 +95,7 @@ function task_initializeBucket(bucket) {
transition: visitType,
visitDate: now
});
bhist.markPageAsTyped(calculatedURI);
histsvc.markPageAsTyped(calculatedURI);
}
}
}