OLD | NEW |
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 #include "chrome/browser/google/google_url_tracker_navigation_helper_impl.h" | 5 #include "chrome/browser/google/google_url_tracker_navigation_helper_impl.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/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
10 #include "content/public/browser/navigation_controller.h" | 10 #include "content/public/browser/navigation_controller.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
63 bool GoogleURLTrackerNavigationHelperImpl::IsListeningForTabDestruction() { | 63 bool GoogleURLTrackerNavigationHelperImpl::IsListeningForTabDestruction() { |
64 return registrar_.IsRegistered( | 64 return registrar_.IsRegistered( |
65 this, | 65 this, |
66 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 66 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
67 content::Source<content::WebContents>(web_contents_)); | 67 content::Source<content::WebContents>(web_contents_)); |
68 } | 68 } |
69 | 69 |
| 70 void GoogleURLTrackerNavigationHelperImpl::OpenURL( |
| 71 GURL url, |
| 72 WindowOpenDisposition disposition, |
| 73 bool user_clicked_on_link) { |
| 74 content::PageTransition transition_type = user_clicked_on_link ? |
| 75 content::PAGE_TRANSITION_LINK : content::PAGE_TRANSITION_GENERATED; |
| 76 web_contents_->OpenURL(content::OpenURLParams( |
| 77 url, content::Referrer(), disposition, transition_type, false)); |
| 78 } |
| 79 |
70 void GoogleURLTrackerNavigationHelperImpl::Observe( | 80 void GoogleURLTrackerNavigationHelperImpl::Observe( |
71 int type, | 81 int type, |
72 const content::NotificationSource& source, | 82 const content::NotificationSource& source, |
73 const content::NotificationDetails& details) { | 83 const content::NotificationDetails& details) { |
74 switch (type) { | 84 switch (type) { |
75 case content::NOTIFICATION_NAV_ENTRY_COMMITTED: { | 85 case content::NOTIFICATION_NAV_ENTRY_COMMITTED: { |
76 content::NavigationController* controller = | 86 content::NavigationController* controller = |
77 content::Source<content::NavigationController>(source).ptr(); | 87 content::Source<content::NavigationController>(source).ptr(); |
78 DCHECK_EQ(web_contents_, controller->GetWebContents()); | 88 DCHECK_EQ(web_contents_, controller->GetWebContents()); |
79 | 89 |
(...skipping 13 matching lines...) Expand all Loading... |
93 DCHECK_EQ(web_contents_, | 103 DCHECK_EQ(web_contents_, |
94 content::Source<content::WebContents>(source).ptr()); | 104 content::Source<content::WebContents>(source).ptr()); |
95 google_url_tracker()->OnTabClosed(this); | 105 google_url_tracker()->OnTabClosed(this); |
96 break; | 106 break; |
97 } | 107 } |
98 | 108 |
99 default: | 109 default: |
100 NOTREACHED() << "Unknown notification received:" << type; | 110 NOTREACHED() << "Unknown notification received:" << type; |
101 } | 111 } |
102 } | 112 } |
OLD | NEW |