| 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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "base/win/win_util.h" | 14 #include "base/win/win_util.h" |
| 15 #include "chrome/app/chrome_command_ids.h" | 15 #include "chrome/app/chrome_command_ids.h" |
| 16 #include "chrome/app/chrome_dll_resource.h" | 16 #include "chrome/app/chrome_dll_resource.h" |
| 17 #include "chrome/browser/automation/automation_provider.h" | 17 #include "chrome/browser/automation/automation_provider.h" |
| 18 #include "chrome/browser/debugger/devtools_toggle_action.h" | 18 #include "chrome/browser/debugger/devtools_toggle_action.h" |
| 19 #include "chrome/browser/debugger/devtools_window.h" | 19 #include "chrome/browser/debugger/devtools_window.h" |
| 20 #include "chrome/browser/google/google_util.h" | |
| 21 #include "chrome/browser/history/history_types.h" | 20 #include "chrome/browser/history/history_types.h" |
| 22 #include "chrome/browser/history/history_tab_helper.h" | 21 #include "chrome/browser/history/history_tab_helper.h" |
| 23 #include "chrome/browser/infobars/infobar_tab_helper.h" | 22 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" | 24 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" |
| 26 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 25 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
| 27 #include "chrome/browser/ui/browser.h" | 26 #include "chrome/browser/ui/browser.h" |
| 28 #include "chrome/browser/ui/browser_window.h" | 27 #include "chrome/browser/ui/browser_window.h" |
| 29 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 28 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 30 #include "chrome/browser/ui/views/browser_dialogs.h" | 29 #include "chrome/browser/ui/views/browser_dialogs.h" |
| (...skipping 53 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 |