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