OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/external_tab_container_win.h" | 5 #include "chrome/browser/external_tab_container_win.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "chrome/browser/history/history_tab_helper.h" | 22 #include "chrome/browser/history/history_tab_helper.h" |
23 #include "chrome/browser/infobars/infobar_tab_helper.h" | 23 #include "chrome/browser/infobars/infobar_tab_helper.h" |
24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
25 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" | 25 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" |
26 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 26 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
27 #include "chrome/browser/ui/browser.h" | 27 #include "chrome/browser/ui/browser.h" |
28 #include "chrome/browser/ui/browser_window.h" | 28 #include "chrome/browser/ui/browser_window.h" |
29 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 29 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
30 #include "chrome/browser/ui/views/browser_dialogs.h" | 30 #include "chrome/browser/ui/views/browser_dialogs.h" |
31 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" | 31 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" |
32 #include "chrome/browser/ui/views/page_info_bubble_view.h" | |
33 #include "chrome/browser/ui/views/tab_contents/render_view_context_menu_views.h" | 32 #include "chrome/browser/ui/views/tab_contents/render_view_context_menu_views.h" |
34 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" | 33 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" |
35 #include "chrome/common/automation_messages.h" | 34 #include "chrome/common/automation_messages.h" |
36 #include "chrome/common/chrome_constants.h" | 35 #include "chrome/common/chrome_constants.h" |
37 #include "chrome/common/chrome_notification_types.h" | 36 #include "chrome/common/chrome_notification_types.h" |
38 #include "chrome/common/render_messages.h" | 37 #include "chrome/common/render_messages.h" |
39 #include "chrome/common/url_constants.h" | 38 #include "chrome/common/url_constants.h" |
40 #include "content/browser/load_notification_details.h" | 39 #include "content/browser/load_notification_details.h" |
41 #include "content/browser/renderer_host/render_view_host.h" | 40 #include "content/browser/renderer_host/render_view_host.h" |
42 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" | 41 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 83 |
85 new_model->items.push_back(item); | 84 new_model->items.push_back(item); |
86 } | 85 } |
87 } | 86 } |
88 | 87 |
89 return new_model; | 88 return new_model; |
90 } | 89 } |
91 | 90 |
92 } // namespace | 91 } // namespace |
93 | 92 |
94 // This class overrides the LinkClicked function in the PageInfoBubbleView | |
95 // class and routes the help center link navigation to the host browser. | |
96 class ExternalTabPageInfoBubbleView : public PageInfoBubbleView { | |
97 public: | |
98 ExternalTabPageInfoBubbleView(ExternalTabContainer* container, | |
99 gfx::NativeWindow parent_window, | |
100 Profile* profile, | |
101 const GURL& url, | |
102 const NavigationEntry::SSLStatus& ssl, | |
103 bool show_history) | |
104 : PageInfoBubbleView(parent_window, profile, url, ssl, show_history), | |
105 container_(container) { | |
106 DVLOG(1) << __FUNCTION__; | |
107 } | |
108 virtual ~ExternalTabPageInfoBubbleView() { | |
109 DVLOG(1) << __FUNCTION__; | |
110 } | |
111 // LinkListener methods: | |
112 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE { | |
113 GURL url = google_util::AppendGoogleLocaleParam( | |
114 GURL(chrome::kPageInfoHelpCenterURL)); | |
115 container_->OpenURLFromTab(container_->tab_contents(), url, GURL(), | |
116 NEW_FOREGROUND_TAB, | |
117 content::PAGE_TRANSITION_LINK); | |
118 } | |
119 private: | |
120 scoped_refptr<ExternalTabContainer> container_; | |
121 }; | |
122 | |
123 base::LazyInstance<ExternalTabContainer::PendingTabs> | 93 base::LazyInstance<ExternalTabContainer::PendingTabs> |
124 ExternalTabContainer::pending_tabs_ = LAZY_INSTANCE_INITIALIZER; | 94 ExternalTabContainer::pending_tabs_ = LAZY_INSTANCE_INITIALIZER; |
125 | 95 |
126 ExternalTabContainer::ExternalTabContainer( | 96 ExternalTabContainer::ExternalTabContainer( |
127 AutomationProvider* automation, AutomationResourceMessageFilter* filter) | 97 AutomationProvider* automation, AutomationResourceMessageFilter* filter) |
128 : views::NativeWidgetWin(new views::Widget), | 98 : views::NativeWidgetWin(new views::Widget), |
129 automation_(automation), | 99 automation_(automation), |
130 tab_contents_container_(NULL), | 100 tab_contents_container_(NULL), |
131 tab_handle_(0), | 101 tab_handle_(0), |
132 ignore_next_load_notification_(false), | 102 ignore_next_load_notification_(false), |
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1206 if (params.disposition == CURRENT_TAB) { | 1176 if (params.disposition == CURRENT_TAB) { |
1207 DCHECK(route_all_top_level_navigations_); | 1177 DCHECK(route_all_top_level_navigations_); |
1208 forward_params.disposition = NEW_FOREGROUND_TAB; | 1178 forward_params.disposition = NEW_FOREGROUND_TAB; |
1209 } | 1179 } |
1210 TabContents* new_contents = | 1180 TabContents* new_contents = |
1211 ExternalTabContainer::OpenURLFromTab(source, forward_params); | 1181 ExternalTabContainer::OpenURLFromTab(source, forward_params); |
1212 // support only one navigation for a dummy tab before it is killed. | 1182 // support only one navigation for a dummy tab before it is killed. |
1213 ::DestroyWindow(GetNativeView()); | 1183 ::DestroyWindow(GetNativeView()); |
1214 return new_contents; | 1184 return new_contents; |
1215 } | 1185 } |
OLD | NEW |