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

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_cocoa.mm

Issue 161293002: mac: Allows extensions to hide the bookmark page menu item. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor cleanup. Created 6 years, 10 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/cocoa/browser_window_cocoa.h" 5 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #import "chrome/browser/ui/cocoa/web_dialog_window_controller.h" 44 #import "chrome/browser/ui/cocoa/web_dialog_window_controller.h"
45 #import "chrome/browser/ui/cocoa/website_settings_bubble_controller.h" 45 #import "chrome/browser/ui/cocoa/website_settings_bubble_controller.h"
46 #include "chrome/browser/ui/search/search_model.h" 46 #include "chrome/browser/ui/search/search_model.h"
47 #include "chrome/browser/ui/tabs/tab_strip_model.h" 47 #include "chrome/browser/ui/tabs/tab_strip_model.h"
48 #include "chrome/browser/web_applications/web_app.h" 48 #include "chrome/browser/web_applications/web_app.h"
49 #include "chrome/common/chrome_switches.h" 49 #include "chrome/common/chrome_switches.h"
50 #include "chrome/common/pref_names.h" 50 #include "chrome/common/pref_names.h"
51 #include "components/autofill/core/common/password_form.h" 51 #include "components/autofill/core/common/password_form.h"
52 #include "content/public/browser/native_web_keyboard_event.h" 52 #include "content/public/browser/native_web_keyboard_event.h"
53 #include "content/public/browser/notification_details.h" 53 #include "content/public/browser/notification_details.h"
54 #include "content/public/browser/notification_service.h"
54 #include "content/public/browser/notification_source.h" 55 #include "content/public/browser/notification_source.h"
55 #include "content/public/browser/web_contents.h" 56 #include "content/public/browser/web_contents.h"
56 #include "content/public/browser/web_contents_view.h" 57 #include "content/public/browser/web_contents_view.h"
57 #include "grit/chromium_strings.h" 58 #include "grit/chromium_strings.h"
58 #include "grit/generated_resources.h" 59 #include "grit/generated_resources.h"
59 #include "ui/base/l10n/l10n_util_mac.h" 60 #include "ui/base/l10n/l10n_util_mac.h"
60 #include "ui/gfx/rect.h" 61 #include "ui/gfx/rect.h"
61 62
62 #if defined(ENABLE_ONE_CLICK_SIGNIN) 63 #if defined(ENABLE_ONE_CLICK_SIGNIN)
63 #import "chrome/browser/ui/cocoa/one_click_signin_bubble_controller.h" 64 #import "chrome/browser/ui/cocoa/one_click_signin_bubble_controller.h"
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 // A.height() + H and RenderWidgetHostView's height becomes A.height() + 2H. 750 // A.height() + H and RenderWidgetHostView's height becomes A.height() + 2H.
750 // Strangely, the RenderWidgetHostView for the previous navigation entry also 751 // Strangely, the RenderWidgetHostView for the previous navigation entry also
751 // gets enlarged by H. 752 // gets enlarged by H.
752 // I believe these "automatic" resizing are caused by setAutoresizingMask of 753 // I believe these "automatic" resizing are caused by setAutoresizingMask of
753 // of the cocoa view in WebContentsViewMac, which defeats the purpose of 754 // of the cocoa view in WebContentsViewMac, which defeats the purpose of
754 // WebContentsDelegate::GetSizeForNewRenderView i.e. to prevent resizing of 755 // WebContentsDelegate::GetSizeForNewRenderView i.e. to prevent resizing of
755 // RenderWidgetHostView in (2) and (3). 756 // RenderWidgetHostView in (2) and (3).
756 return 0; 757 return 0;
757 } 758 }
758 759
760 void BrowserWindowCocoa::ShowExtensionActionPopup(
761 extensions::CommandService::ExtensionCommandType type,
762 std::string extension_id) {
763 // Set the notification type.
764 int notification_type;
Robert Sesek 2014/02/26 18:05:13 Initialize this since you do not have a default: c
erikchen 2014/02/26 19:58:23 method was removed. On 2014/02/26 18:05:13, rsese
765 switch (type) {
766 case extensions::CommandService::NAMED:
767 NOTREACHED();
768 return;
769 case extensions::CommandService::BROWSER_ACTION:
770 notification_type =
771 chrome::NOTIFICATION_EXTENSION_COMMAND_PAGE_ACTION_MAC;
772 break;
773 case extensions::CommandService::PAGE_ACTION:
774 notification_type =
775 chrome::NOTIFICATION_EXTENSION_COMMAND_BROWSER_ACTION_MAC;
776 break;
777 }
778 // Dispatch a notification, which triggers the popup.
779 std::pair<const std::string, gfx::NativeWindow> details =
780 std::make_pair(extension_id, window());
781 content::NotificationService::current()->Notify(
Robert Sesek 2014/02/26 18:05:13 There's an active effort to remove notifications f
erikchen 2014/02/26 19:58:23 certainly. I've plumbed through the necessary logi
782 notification_type,
783 content::Source<Profile>(browser_->profile()),
784 content::Details<std::pair<const std::string, gfx::NativeWindow> >(
785 &details));
786 }
787
759 void BrowserWindowCocoa::ShowPageActionPopup( 788 void BrowserWindowCocoa::ShowPageActionPopup(
760 const extensions::Extension* extension) { 789 const extensions::Extension* extension) {
761 NOTIMPLEMENTED(); 790 ShowExtensionActionPopup(extensions::CommandService::PAGE_ACTION,
791 extension->id());
762 } 792 }
763 793
764 void BrowserWindowCocoa::ShowBrowserActionPopup( 794 void BrowserWindowCocoa::ShowBrowserActionPopup(
765 const extensions::Extension* extension) { 795 const extensions::Extension* extension) {
766 NOTIMPLEMENTED(); 796 ShowExtensionActionPopup(extensions::CommandService::BROWSER_ACTION,
797 extension->id());
767 } 798 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698