OLD | NEW |
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 "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
8 #include "chrome/browser/google/google_url_tracker.h" | 8 #include "chrome/browser/google/google_url_tracker.h" |
9 #include "chrome/browser/google/google_url_tracker_navigation_helper_impl.h" | |
10 #include "chrome/browser/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
11 #include "content/public/browser/navigation_controller.h" | 10 #include "content/public/browser/navigation_controller.h" |
12 #include "content/public/browser/navigation_entry.h" | 11 #include "content/public/browser/navigation_entry.h" |
13 #include "content/public/browser/notification_service.h" | 12 #include "content/public/browser/notification_service.h" |
14 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
15 | 14 |
16 ChromeGoogleURLTrackerClient::ChromeGoogleURLTrackerClient() { | 15 ChromeGoogleURLTrackerClient::ChromeGoogleURLTrackerClient() { |
17 } | 16 } |
18 | 17 |
19 ChromeGoogleURLTrackerClient::~ChromeGoogleURLTrackerClient() { | 18 ChromeGoogleURLTrackerClient::~ChromeGoogleURLTrackerClient() { |
(...skipping 22 matching lines...) Expand all Loading... |
42 | 41 |
43 void ChromeGoogleURLTrackerClient::Observe( | 42 void ChromeGoogleURLTrackerClient::Observe( |
44 int type, | 43 int type, |
45 const content::NotificationSource& source, | 44 const content::NotificationSource& source, |
46 const content::NotificationDetails& details) { | 45 const content::NotificationDetails& details) { |
47 DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_PENDING, type); | 46 DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_PENDING, type); |
48 content::NavigationController* controller = | 47 content::NavigationController* controller = |
49 content::Source<content::NavigationController>(source).ptr(); | 48 content::Source<content::NavigationController>(source).ptr(); |
50 InfoBarService* infobar_service = | 49 InfoBarService* infobar_service = |
51 InfoBarService::FromWebContents(controller->GetWebContents()); | 50 InfoBarService::FromWebContents(controller->GetWebContents()); |
52 // Because we're listening to all sources, there may be no InfoBarService for | 51 // Because we're listening to all sources, there may be no |
53 // some notifications, e.g. navigations in bubbles/balloons etc. | 52 // InfoBarService for some notifications, e.g. navigations in |
| 53 // bubbles/balloons etc. |
54 if (infobar_service) { | 54 if (infobar_service) { |
55 google_url_tracker()->OnNavigationPending( | 55 google_url_tracker()->OnNavigationPending( |
56 scoped_ptr<GoogleURLTrackerNavigationHelper>( | 56 controller, |
57 new GoogleURLTrackerNavigationHelperImpl( | |
58 controller->GetWebContents(), google_url_tracker())), | |
59 infobar_service, | 57 infobar_service, |
60 controller->GetPendingEntry()->GetUniqueID()); | 58 controller->GetPendingEntry()->GetUniqueID()); |
61 } | 59 } |
62 } | 60 } |
OLD | NEW |