| 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 "app/l10n_util.h" |
| 7 #include "app/win_util.h" | 8 #include "app/win_util.h" |
| 8 #include "base/logging.h" | 9 #include "base/logging.h" |
| 9 #include "base/win_util.h" | 10 #include "base/win_util.h" |
| 10 #include "chrome/browser/automation/automation_provider.h" | 11 #include "chrome/browser/automation/automation_provider.h" |
| 11 #include "chrome/browser/browser.h" | 12 #include "chrome/browser/browser.h" |
| 12 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 13 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| 13 #include "chrome/browser/load_notification_details.h" | 14 #include "chrome/browser/load_notification_details.h" |
| 14 #include "chrome/browser/profile.h" | 15 #include "chrome/browser/profile.h" |
| 15 #include "chrome/browser/tab_contents/provisional_load_details.h" | 16 #include "chrome/browser/tab_contents/provisional_load_details.h" |
| 16 #include "chrome/browser/tab_contents/render_view_context_menu_external_win.h" | 17 #include "chrome/browser/tab_contents/render_view_context_menu_external_win.h" |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 | 262 |
| 262 bool ExternalTabContainer::HandleContextMenu(const ContextMenuParams& params) { | 263 bool ExternalTabContainer::HandleContextMenu(const ContextMenuParams& params) { |
| 263 if (!automation_) { | 264 if (!automation_) { |
| 264 NOTREACHED(); | 265 NOTREACHED(); |
| 265 return false; | 266 return false; |
| 266 } | 267 } |
| 267 | 268 |
| 268 external_context_menu_.reset( | 269 external_context_menu_.reset( |
| 269 new RenderViewContextMenuExternalWin(tab_contents(), | 270 new RenderViewContextMenuExternalWin(tab_contents(), |
| 270 params, | 271 params, |
| 271 GetNativeView(), | |
| 272 disabled_context_menu_ids_)); | 272 disabled_context_menu_ids_)); |
| 273 external_context_menu_->Init(); | 273 external_context_menu_->Init(); |
| 274 | 274 |
| 275 POINT screen_pt = { params.x, params.y }; | 275 POINT screen_pt = { params.x, params.y }; |
| 276 MapWindowPoints(GetNativeView(), HWND_DESKTOP, &screen_pt, 1); | 276 MapWindowPoints(GetNativeView(), HWND_DESKTOP, &screen_pt, 1); |
| 277 | 277 |
| 278 bool rtl = l10n_util::TextDirection() == l10n_util::RIGHT_TO_LEFT; |
| 278 automation_->Send( | 279 automation_->Send( |
| 279 new AutomationMsg_ForwardContextMenuToExternalHost(0, tab_handle_, | 280 new AutomationMsg_ForwardContextMenuToExternalHost(0, tab_handle_, |
| 280 external_context_menu_->GetMenuHandle(), screen_pt.x, screen_pt.y, | 281 external_context_menu_->GetMenuHandle(), screen_pt.x, screen_pt.y, |
| 281 external_context_menu_->GetTPMAlignFlags())); | 282 rtl ? TPM_RIGHTALIGN : TPM_LEFTALIGN)); |
| 282 | 283 |
| 283 return true; | 284 return true; |
| 284 } | 285 } |
| 285 | 286 |
| 286 bool ExternalTabContainer::ExecuteContextMenuCommand(int command) { | 287 bool ExternalTabContainer::ExecuteContextMenuCommand(int command) { |
| 287 if (!external_context_menu_.get()) { | 288 if (!external_context_menu_.get()) { |
| 288 NOTREACHED(); | 289 NOTREACHED(); |
| 289 return false; | 290 return false; |
| 290 } | 291 } |
| 291 | 292 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 if (tab_contents_) { | 412 if (tab_contents_) { |
| 412 NotificationService::current()->Notify( | 413 NotificationService::current()->Notify( |
| 413 NotificationType::EXTERNAL_TAB_CLOSED, | 414 NotificationType::EXTERNAL_TAB_CLOSED, |
| 414 Source<NavigationController>(&tab_contents_->controller()), | 415 Source<NavigationController>(&tab_contents_->controller()), |
| 415 Details<ExternalTabContainer>(this)); | 416 Details<ExternalTabContainer>(this)); |
| 416 | 417 |
| 417 delete tab_contents_; | 418 delete tab_contents_; |
| 418 tab_contents_ = NULL; | 419 tab_contents_ = NULL; |
| 419 } | 420 } |
| 420 } | 421 } |
| OLD | NEW |