Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Unified Diff: chrome/browser/ui/omnibox/omnibox_navigation_observer.cc

Issue 27057004: Make the OmniboxNavigationObserver update the ShortcutsProvider. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_navigation_observer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/omnibox/omnibox_navigation_observer.cc
===================================================================
--- chrome/browser/ui/omnibox/omnibox_navigation_observer.cc (revision 228523)
+++ chrome/browser/ui/omnibox/omnibox_navigation_observer.cc (working copy)
@@ -4,6 +4,8 @@
#include "chrome/browser/ui/omnibox/omnibox_navigation_observer.h"
+#include "chrome/browser/history/shortcuts_backend.h"
+#include "chrome/browser/history/shortcuts_backend_factory.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/intranet_redirect_detector.h"
#include "chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.h"
@@ -49,8 +51,14 @@
// OmniboxNavigationObserver --------------------------------------------------
OmniboxNavigationObserver::OmniboxNavigationObserver(
+ Profile* profile,
+ const string16& text,
+ const AutocompleteMatch& match,
const GURL& alternate_nav_url)
- : alternate_nav_url_(alternate_nav_url),
+ : text_(text),
+ match_(match),
+ alternate_nav_url_(alternate_nav_url),
+ shortcuts_backend_(ShortcutsBackendFactory::GetForProfile(profile)),
load_state_(LOAD_NOT_SEEN),
fetch_state_(FETCH_NOT_COMPLETE) {
if (alternate_nav_url_.is_valid()) {
@@ -68,6 +76,11 @@
OmniboxNavigationObserver::~OmniboxNavigationObserver() {
}
+void OmniboxNavigationObserver::OnSuccessfulNavigation() {
+ if (shortcuts_backend_)
Bart N. 2013/10/16 17:42:47 This looks odd. The only place where you assign sh
+ shortcuts_backend_->OnOmniboxNavigation(text_, match_);
+}
+
void OmniboxNavigationObserver::Observe(
int type,
const content::NotificationSource& source,
@@ -88,6 +101,9 @@
void OmniboxNavigationObserver::NavigationEntryCommitted(
const content::LoadCommittedDetails& load_details) {
load_state_ = LOAD_COMMITTED;
+ if (ResponseCodeIndicatesSuccess(load_details.http_status_code) &&
+ IsValidNavigation(match_.destination_url, load_details.entry->GetURL()))
+ OnSuccessfulNavigation();
if (!fetcher_ || (fetch_state_ != FETCH_NOT_COMPLETE))
OnAllLoadingFinished(); // deletes |this|!
}
@@ -111,6 +127,7 @@
void OmniboxNavigationObserver::OnURLFetchComplete(
const net::URLFetcher* source) {
+ DCHECK_EQ(fetcher_.get(), source);
const net::URLRequestStatus& status = source->GetStatus();
int response_code = source->GetResponseCode();
fetch_state_ =
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_navigation_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698