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

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/page_action_decoration.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: Make sure changes only apply to OSX. Created 6 years, 9 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 <cmath> 5 #include <cmath>
6 6
7 #import "chrome/browser/ui/cocoa/location_bar/page_action_decoration.h" 7 #import "chrome/browser/ui/cocoa/location_bar/page_action_decoration.h"
8 8
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 bool PageActionDecoration::AcceptsMousePress() { 81 bool PageActionDecoration::AcceptsMousePress() {
82 return true; 82 return true;
83 } 83 }
84 84
85 // Either notify listeners or show a popup depending on the Page 85 // Either notify listeners or show a popup depending on the Page
86 // Action. 86 // Action.
87 bool PageActionDecoration::OnMousePressed(NSRect frame) { 87 bool PageActionDecoration::OnMousePressed(NSRect frame) {
88 return ActivatePageAction(frame); 88 return ActivatePageAction(frame);
89 } 89 }
90 90
91 void PageActionDecoration::ActivatePageAction() {
92 ActivatePageAction(owner_->GetPageActionFrame(page_action_));
93 }
94
91 bool PageActionDecoration::ActivatePageAction(NSRect frame) { 95 bool PageActionDecoration::ActivatePageAction(NSRect frame) {
92 WebContents* web_contents = owner_->GetWebContents(); 96 WebContents* web_contents = owner_->GetWebContents();
93 if (!web_contents) { 97 if (!web_contents) {
94 // We don't want other code to try and handle this click. Returning true 98 // We don't want other code to try and handle this click. Returning true
95 // prevents this by indicating that we handled it. 99 // prevents this by indicating that we handled it.
96 return true; 100 return true;
97 } 101 }
98 102
99 LocationBarController* controller = 103 LocationBarController* controller =
100 extensions::TabHelper::FromWebContents(web_contents)-> 104 extensions::TabHelper::FromWebContents(web_contents)->
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 std::pair<const std::string, gfx::NativeWindow>* payload = 246 std::pair<const std::string, gfx::NativeWindow>* payload =
243 content::Details<std::pair<const std::string, gfx::NativeWindow> >( 247 content::Details<std::pair<const std::string, gfx::NativeWindow> >(
244 details).ptr(); 248 details).ptr();
245 std::string extension_id = payload->first; 249 std::string extension_id = payload->first;
246 gfx::NativeWindow window = payload->second; 250 gfx::NativeWindow window = payload->second;
247 if (window != browser_->window()->GetNativeWindow()) 251 if (window != browser_->window()->GetNativeWindow())
248 break; 252 break;
249 if (extension_id != page_action_->extension_id()) 253 if (extension_id != page_action_->extension_id())
250 break; 254 break;
251 if (IsVisible()) 255 if (IsVisible())
252 ActivatePageAction(owner_->GetPageActionFrame(page_action_)); 256 ActivatePageAction();
253 break; 257 break;
254 } 258 }
255 259
256 default: 260 default:
257 NOTREACHED() << "Unexpected notification"; 261 NOTREACHED() << "Unexpected notification";
258 break; 262 break;
259 } 263 }
260 } 264 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/page_action_decoration.h ('k') | chrome/browser/ui/cocoa/toolbar/toolbar_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698