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

Side by Side Diff: chrome/browser/ui/navigation_correction_tab_observer.h

Issue 287233007: Revert of Revert of Elimate NOTIFICATION_GOOGLE_URL_UPDATED (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_NAVIGATION_CORRECTION_TAB_OBSERVER_H_ 5 #ifndef CHROME_BROWSER_UI_NAVIGATION_CORRECTION_TAB_OBSERVER_H_
6 #define CHROME_BROWSER_UI_NAVIGATION_CORRECTION_TAB_OBSERVER_H_ 6 #define CHROME_BROWSER_UI_NAVIGATION_CORRECTION_TAB_OBSERVER_H_
7 7
8 #include "base/prefs/pref_change_registrar.h" 8 #include "base/prefs/pref_change_registrar.h"
9 #include "content/public/browser/notification_observer.h" 9 #include "chrome/browser/google/google_url_tracker.h"
10 #include "content/public/browser/notification_registrar.h"
11 #include "content/public/browser/web_contents_observer.h" 10 #include "content/public/browser/web_contents_observer.h"
12 #include "content/public/browser/web_contents_user_data.h" 11 #include "content/public/browser/web_contents_user_data.h"
13 12
14 class Profile; 13 class Profile;
15 14
16 namespace user_prefs { 15 namespace user_prefs {
17 class PrefRegistrySyncable; 16 class PrefRegistrySyncable;
18 } 17 }
19 18
20 // Per-tab class to implement navigation suggestion service functionality. 19 // Per-tab class to implement navigation suggestion service functionality.
21 class NavigationCorrectionTabObserver 20 class NavigationCorrectionTabObserver
22 : public content::WebContentsObserver, 21 : public content::WebContentsObserver,
23 public content::NotificationObserver,
24 public content::WebContentsUserData<NavigationCorrectionTabObserver> { 22 public content::WebContentsUserData<NavigationCorrectionTabObserver> {
25 public: 23 public:
26 virtual ~NavigationCorrectionTabObserver(); 24 virtual ~NavigationCorrectionTabObserver();
27 25
28 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 26 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
29 27
30 private: 28 private:
31 explicit NavigationCorrectionTabObserver(content::WebContents* web_contents); 29 explicit NavigationCorrectionTabObserver(content::WebContents* web_contents);
32 friend class content::WebContentsUserData<NavigationCorrectionTabObserver>; 30 friend class content::WebContentsUserData<NavigationCorrectionTabObserver>;
33 31
34 // content::WebContentsObserver overrides: 32 // content::WebContentsObserver overrides:
35 virtual void RenderViewCreated( 33 virtual void RenderViewCreated(
36 content::RenderViewHost* render_view_host) OVERRIDE; 34 content::RenderViewHost* render_view_host) OVERRIDE;
37 35
38 // content::NotificationObserver overrides: 36 // Internal helpers ----------------------------------------------------------
39 virtual void Observe(int type,
40 const content::NotificationSource& source,
41 const content::NotificationDetails& details) OVERRIDE;
42 37
43 // Internal helpers ---------------------------------------------------------- 38 // Callback that is called when the Google URL is updated.
39 void OnGoogleURLUpdated(GURL old_url, GURL new_url);
44 40
45 // Returns the URL for the correction service. If the returned URL 41 // Returns the URL for the correction service. If the returned URL
46 // is empty, the default error pages will be used. 42 // is empty, the default error pages will be used.
47 GURL GetNavigationCorrectionURL() const; 43 GURL GetNavigationCorrectionURL() const;
48 44
49 // Called when navigation corrections are enabled or disabled. 45 // Called when navigation corrections are enabled or disabled.
50 void OnEnabledChanged(); 46 void OnEnabledChanged();
51 47
52 // Updates the renderer's navigation correction service configuration. 48 // Updates the renderer's navigation correction service configuration.
53 void UpdateNavigationCorrectionInfo(content::RenderViewHost* rvh); 49 void UpdateNavigationCorrectionInfo(content::RenderViewHost* rvh);
54 50
55 Profile* profile_; 51 Profile* profile_;
56 content::NotificationRegistrar registrar_;
57 PrefChangeRegistrar pref_change_registrar_; 52 PrefChangeRegistrar pref_change_registrar_;
53 scoped_ptr<GoogleURLTracker::Subscription> google_url_updated_subscription_;
58 54
59 DISALLOW_COPY_AND_ASSIGN(NavigationCorrectionTabObserver); 55 DISALLOW_COPY_AND_ASSIGN(NavigationCorrectionTabObserver);
60 }; 56 };
61 57
62 #endif // CHROME_BROWSER_UI_NAVIGATION_CORRECTION_TAB_OBSERVER_H_ 58 #endif // CHROME_BROWSER_UI_NAVIGATION_CORRECTION_TAB_OBSERVER_H_
OLDNEW
« no previous file with comments | « chrome/browser/google/google_url_tracker_unittest.cc ('k') | chrome/browser/ui/navigation_correction_tab_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698