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

Side by Side Diff: chrome/browser/google/chrome_google_url_tracker_client.cc

Issue 316203003: Componentize GoogleURLTracker(InfoBarDelegate,MapEntry,NavHelper) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits Created 6 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "chrome/browser/google/chrome_google_url_tracker_client.h" 5 #include "chrome/browser/google/chrome_google_url_tracker_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/google/google_url_tracker.h"
10 #include "chrome/browser/google/google_url_tracker_navigation_helper_impl.h" 9 #include "chrome/browser/google/google_url_tracker_navigation_helper_impl.h"
10 #include "chrome/browser/google/google_util.h"
11 #include "chrome/browser/infobars/infobar_service.h" 11 #include "chrome/browser/infobars/infobar_service.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 #include "components/google/core/browser/google_url_tracker.h"
14 #include "content/public/browser/navigation_controller.h" 15 #include "content/public/browser/navigation_controller.h"
15 #include "content/public/browser/navigation_entry.h" 16 #include "content/public/browser/navigation_entry.h"
16 #include "content/public/browser/notification_service.h" 17 #include "content/public/browser/notification_service.h"
17 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
18 19
19 ChromeGoogleURLTrackerClient::ChromeGoogleURLTrackerClient(Profile* profile) 20 ChromeGoogleURLTrackerClient::ChromeGoogleURLTrackerClient(Profile* profile)
20 : profile_(profile) { 21 : profile_(profile) {
21 } 22 }
22 23
23 ChromeGoogleURLTrackerClient::~ChromeGoogleURLTrackerClient() { 24 ChromeGoogleURLTrackerClient::~ChromeGoogleURLTrackerClient() {
(...skipping 27 matching lines...) Expand all
51 52
52 PrefService* ChromeGoogleURLTrackerClient::GetPrefs() { 53 PrefService* ChromeGoogleURLTrackerClient::GetPrefs() {
53 return profile_->GetPrefs(); 54 return profile_->GetPrefs();
54 } 55 }
55 56
56 net::URLRequestContextGetter* 57 net::URLRequestContextGetter*
57 ChromeGoogleURLTrackerClient::GetRequestContext() { 58 ChromeGoogleURLTrackerClient::GetRequestContext() {
58 return profile_->GetRequestContext(); 59 return profile_->GetRequestContext();
59 } 60 }
60 61
62 bool ChromeGoogleURLTrackerClient::IsGoogleDomainURL(const GURL& url) {
63 return google_util::IsGoogleDomainUrl(
64 url,
65 google_util::DISALLOW_SUBDOMAIN,
66 google_util::DISALLOW_NON_STANDARD_PORTS);
67 }
68
69 GURL ChromeGoogleURLTrackerClient::AppendGoogleLocaleParam(const GURL& url) {
70 return google_util::AppendGoogleLocaleParam(url);
71 }
72
61 void ChromeGoogleURLTrackerClient::Observe( 73 void ChromeGoogleURLTrackerClient::Observe(
62 int type, 74 int type,
63 const content::NotificationSource& source, 75 const content::NotificationSource& source,
64 const content::NotificationDetails& details) { 76 const content::NotificationDetails& details) {
65 DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_PENDING, type); 77 DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_PENDING, type);
66 content::NavigationController* controller = 78 content::NavigationController* controller =
67 content::Source<content::NavigationController>(source).ptr(); 79 content::Source<content::NavigationController>(source).ptr();
68 InfoBarService* infobar_service = 80 InfoBarService* infobar_service =
69 InfoBarService::FromWebContents(controller->GetWebContents()); 81 InfoBarService::FromWebContents(controller->GetWebContents());
70 // Because we're listening to all sources, there may be no InfoBarService for 82 // Because we're listening to all sources, there may be no InfoBarService for
71 // some notifications, e.g. navigations in bubbles/balloons etc. 83 // some notifications, e.g. navigations in bubbles/balloons etc.
72 if (infobar_service) { 84 if (infobar_service) {
73 google_url_tracker()->OnNavigationPending( 85 google_url_tracker()->OnNavigationPending(
74 scoped_ptr<GoogleURLTrackerNavigationHelper>( 86 scoped_ptr<GoogleURLTrackerNavigationHelper>(
75 new GoogleURLTrackerNavigationHelperImpl( 87 new GoogleURLTrackerNavigationHelperImpl(
76 controller->GetWebContents(), google_url_tracker())), 88 controller->GetWebContents(), google_url_tracker())),
77 infobar_service, 89 infobar_service,
78 controller->GetPendingEntry()->GetUniqueID()); 90 controller->GetPendingEntry()->GetUniqueID());
79 } 91 }
80 } 92 }
OLDNEW
« no previous file with comments | « chrome/browser/google/chrome_google_url_tracker_client.h ('k') | chrome/browser/google/google_profile_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698