| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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.h" | 5 #include "chrome/browser/external_tab_container.h" |
| 6 | 6 |
| 7 #include <string> |
| 8 |
| 7 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 8 #include "app/win_util.h" | 10 #include "app/win_util.h" |
| 9 #include "base/logging.h" | 11 #include "base/logging.h" |
| 10 #include "base/win_util.h" | 12 #include "base/win_util.h" |
| 11 #include "chrome/browser/automation/automation_provider.h" | 13 #include "chrome/browser/automation/automation_provider.h" |
| 12 #include "chrome/browser/browser.h" | 14 #include "chrome/browser/browser.h" |
| 13 #include "chrome/browser/load_notification_details.h" | 15 #include "chrome/browser/load_notification_details.h" |
| 14 #include "chrome/browser/profile.h" | 16 #include "chrome/browser/profile.h" |
| 15 #include "chrome/browser/tab_contents/provisional_load_details.h" | 17 #include "chrome/browser/tab_contents/provisional_load_details.h" |
| 16 #include "chrome/browser/views/tab_contents/render_view_context_menu_external_wi
n.h" | 18 #include "chrome/browser/views/tab_contents/render_view_context_menu_external_wi
n.h" |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 void ExternalTabContainer::ContentsZoomChange(bool zoom_in) { | 235 void ExternalTabContainer::ContentsZoomChange(bool zoom_in) { |
| 234 } | 236 } |
| 235 | 237 |
| 236 void ExternalTabContainer::ToolbarSizeChanged(TabContents* source, | 238 void ExternalTabContainer::ToolbarSizeChanged(TabContents* source, |
| 237 bool finished) { | 239 bool finished) { |
| 238 } | 240 } |
| 239 | 241 |
| 240 void ExternalTabContainer::ForwardMessageToExternalHost( | 242 void ExternalTabContainer::ForwardMessageToExternalHost( |
| 241 const std::string& message, const std::string& origin, | 243 const std::string& message, const std::string& origin, |
| 242 const std::string& target) { | 244 const std::string& target) { |
| 243 if(automation_) { | 245 if (automation_) { |
| 244 automation_->Send( | 246 automation_->Send( |
| 245 new AutomationMsg_ForwardMessageToExternalHost(0, tab_handle_, | 247 new AutomationMsg_ForwardMessageToExternalHost(0, tab_handle_, |
| 246 message, origin, target)); | 248 message, origin, target)); |
| 247 } | 249 } |
| 248 } | 250 } |
| 249 | 251 |
| 250 bool ExternalTabContainer::TakeFocus(bool reverse) { | 252 bool ExternalTabContainer::TakeFocus(bool reverse) { |
| 251 if (automation_) { | 253 if (automation_) { |
| 252 automation_->Send(new AutomationMsg_TabbedOut(0, tab_handle_, | 254 automation_->Send(new AutomationMsg_TabbedOut(0, tab_handle_, |
| 253 win_util::IsShiftPressed())); | 255 win_util::IsShiftPressed())); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 264 | 266 |
| 265 external_context_menu_.reset( | 267 external_context_menu_.reset( |
| 266 new RenderViewContextMenuExternalWin(tab_contents(), | 268 new RenderViewContextMenuExternalWin(tab_contents(), |
| 267 params, | 269 params, |
| 268 disabled_context_menu_ids_)); | 270 disabled_context_menu_ids_)); |
| 269 external_context_menu_->Init(); | 271 external_context_menu_->Init(); |
| 270 | 272 |
| 271 POINT screen_pt = { params.x, params.y }; | 273 POINT screen_pt = { params.x, params.y }; |
| 272 MapWindowPoints(GetNativeView(), HWND_DESKTOP, &screen_pt, 1); | 274 MapWindowPoints(GetNativeView(), HWND_DESKTOP, &screen_pt, 1); |
| 273 | 275 |
| 274 bool rtl = l10n_util::TextDirection() == l10n_util::RIGHT_TO_LEFT; | 276 bool rtl = l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT; |
| 275 automation_->Send( | 277 automation_->Send( |
| 276 new AutomationMsg_ForwardContextMenuToExternalHost(0, tab_handle_, | 278 new AutomationMsg_ForwardContextMenuToExternalHost(0, tab_handle_, |
| 277 external_context_menu_->GetMenuHandle(), screen_pt.x, screen_pt.y, | 279 external_context_menu_->GetMenuHandle(), screen_pt.x, screen_pt.y, |
| 278 rtl ? TPM_RIGHTALIGN : TPM_LEFTALIGN)); | 280 rtl ? TPM_RIGHTALIGN : TPM_LEFTALIGN)); |
| 279 | 281 |
| 280 return true; | 282 return true; |
| 281 } | 283 } |
| 282 | 284 |
| 283 bool ExternalTabContainer::ExecuteContextMenuCommand(int command) { | 285 bool ExternalTabContainer::ExecuteContextMenuCommand(int command) { |
| 284 if (!external_context_menu_.get()) { | 286 if (!external_context_menu_.get()) { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 if (tab_contents_) { | 410 if (tab_contents_) { |
| 409 NotificationService::current()->Notify( | 411 NotificationService::current()->Notify( |
| 410 NotificationType::EXTERNAL_TAB_CLOSED, | 412 NotificationType::EXTERNAL_TAB_CLOSED, |
| 411 Source<NavigationController>(&tab_contents_->controller()), | 413 Source<NavigationController>(&tab_contents_->controller()), |
| 412 Details<ExternalTabContainer>(this)); | 414 Details<ExternalTabContainer>(this)); |
| 413 | 415 |
| 414 delete tab_contents_; | 416 delete tab_contents_; |
| 415 tab_contents_ = NULL; | 417 tab_contents_ = NULL; |
| 416 } | 418 } |
| 417 } | 419 } |
| OLD | NEW |