Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(390)

Side by Side Diff: chrome/browser/extensions/extension_host.cc

Issue 4078003: Refactoring select popup on Mac.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/extensions/extension_host.h" 5 #include "chrome/browser/extensions/extension_host.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "app/keyboard_codes.h" 9 #include "app/keyboard_codes.h"
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 16 matching lines...) Expand all
27 #include "chrome/browser/message_box_handler.h" 27 #include "chrome/browser/message_box_handler.h"
28 #include "chrome/browser/platform_util.h" 28 #include "chrome/browser/platform_util.h"
29 #include "chrome/browser/prefs/pref_service.h" 29 #include "chrome/browser/prefs/pref_service.h"
30 #include "chrome/browser/profile.h" 30 #include "chrome/browser/profile.h"
31 #include "chrome/browser/renderer_host/render_process_host.h" 31 #include "chrome/browser/renderer_host/render_process_host.h"
32 #include "chrome/browser/renderer_host/render_view_host.h" 32 #include "chrome/browser/renderer_host/render_view_host.h"
33 #include "chrome/browser/renderer_host/render_widget_host.h" 33 #include "chrome/browser/renderer_host/render_widget_host.h"
34 #include "chrome/browser/renderer_host/render_widget_host_view.h" 34 #include "chrome/browser/renderer_host/render_widget_host_view.h"
35 #include "chrome/browser/renderer_host/site_instance.h" 35 #include "chrome/browser/renderer_host/site_instance.h"
36 #include "chrome/browser/renderer_preferences_util.h" 36 #include "chrome/browser/renderer_preferences_util.h"
37 #include "chrome/browser/tab_contents/popup_menu_helper_mac.h"
37 #include "chrome/browser/tab_contents/tab_contents.h" 38 #include "chrome/browser/tab_contents/tab_contents.h"
38 #include "chrome/browser/tab_contents/tab_contents_view.h" 39 #include "chrome/browser/tab_contents/tab_contents_view.h"
39 #include "chrome/browser/themes/browser_theme_provider.h" 40 #include "chrome/browser/themes/browser_theme_provider.h"
40 #include "chrome/common/bindings_policy.h" 41 #include "chrome/common/bindings_policy.h"
41 #include "chrome/common/extensions/extension.h" 42 #include "chrome/common/extensions/extension.h"
42 #include "chrome/common/extensions/extension_constants.h" 43 #include "chrome/common/extensions/extension_constants.h"
43 #include "chrome/common/native_web_keyboard_event.h" 44 #include "chrome/common/native_web_keyboard_event.h"
44 #include "chrome/common/notification_service.h" 45 #include "chrome/common/notification_service.h"
45 #include "chrome/common/pref_names.h" 46 #include "chrome/common/pref_names.h"
46 #include "chrome/common/render_messages.h" 47 #include "chrome/common/render_messages.h"
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 browser->BrowserRenderWidgetShowing(); 615 browser->BrowserRenderWidgetShowing();
615 // TODO(erikkay): These two lines could be refactored with TabContentsView. 616 // TODO(erikkay): These two lines could be refactored with TabContentsView.
616 widget_host_view->InitAsPopup(render_view_host()->view(), initial_pos); 617 widget_host_view->InitAsPopup(render_view_host()->view(), initial_pos);
617 widget_host_view->GetRenderWidgetHost()->Init(); 618 widget_host_view->GetRenderWidgetHost()->Init();
618 } 619 }
619 620
620 void ExtensionHost::ShowContextMenu(const ContextMenuParams& params) { 621 void ExtensionHost::ShowContextMenu(const ContextMenuParams& params) {
621 // TODO(erikkay) Show a default context menu. 622 // TODO(erikkay) Show a default context menu.
622 } 623 }
623 624
625 void ExtensionHost::ShowPopupMenu(const gfx::Rect& bounds,
626 int item_height,
627 double item_font_size,
628 int selected_item,
629 const std::vector<WebMenuItem>& items,
630 bool right_aligned) {
631 #if defined(OS_MACOSX)
632 PopupMenuHelper popup_menu_helper(render_view_host());
633 popup_menu_helper.ShowPopupMenu(bounds, item_height, item_font_size,
634 selected_item, items, right_aligned);
635 #else
636 // Only on Mac are select popup menus external.
637 NOTREACHED();
638 #endif
639 }
640
624 void ExtensionHost::StartDragging(const WebDropData& drop_data, 641 void ExtensionHost::StartDragging(const WebDropData& drop_data,
625 WebDragOperationsMask operation_mask, 642 WebDragOperationsMask operation_mask,
626 const SkBitmap& image, 643 const SkBitmap& image,
627 const gfx::Point& image_offset) { 644 const gfx::Point& image_offset) {
628 // We're not going to do any drag & drop, but we have to tell the renderer the 645 // We're not going to do any drag & drop, but we have to tell the renderer the
629 // drag & drop ended, othewise the renderer thinks the drag operation is 646 // drag & drop ended, othewise the renderer thinks the drag operation is
630 // underway and mouse events won't work. See bug 34061. 647 // underway and mouse events won't work. See bug 34061.
631 // TODO(twiz) Implement drag & drop support for ExtensionHost instances. 648 // TODO(twiz) Implement drag & drop support for ExtensionHost instances.
632 // See feature issue 36288. 649 // See feature issue 36288.
633 render_view_host()->DragSourceSystemDragEnded(); 650 render_view_host()->DragSourceSystemDragEnded();
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 // Extensions hosted in ExternalTabContainer objects may not have 762 // Extensions hosted in ExternalTabContainer objects may not have
746 // an associated browser. 763 // an associated browser.
747 Browser* browser = GetBrowser(); 764 Browser* browser = GetBrowser();
748 if (browser) 765 if (browser)
749 window_id = ExtensionTabUtil::GetWindowId(browser); 766 window_id = ExtensionTabUtil::GetWindowId(browser);
750 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { 767 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) {
751 NOTREACHED(); 768 NOTREACHED();
752 } 769 }
753 return window_id; 770 return window_id;
754 } 771 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_host.h ('k') | chrome/browser/extensions/extension_host_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698