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

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm

Issue 489183005: Make a ShowExtensionActionPopup function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Peter's Created 6 years, 3 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" 5 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.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/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 226
227 [field_ updateMouseTracking]; 227 [field_ updateMouseTracking];
228 [field_ setNeedsDisplay:YES]; 228 [field_ setNeedsDisplay:YES];
229 } 229 }
230 230
231 void LocationBarViewMac::InvalidatePageActions() { 231 void LocationBarViewMac::InvalidatePageActions() {
232 DeletePageActionDecorations(); 232 DeletePageActionDecorations();
233 Layout(); 233 Layout();
234 } 234 }
235 235
236 bool LocationBarViewMac::ShowPageActionPopup(
237 const extensions::Extension* extension, bool grant_active_tab) {
238 for (ScopedVector<PageActionDecoration>::iterator iter =
239 page_action_decorations_.begin();
240 iter != page_action_decorations_.end(); ++iter) {
241 if ((*iter)->page_action()->extension_id() == extension->id())
242 return (*iter)->ActivatePageAction(grant_active_tab);
243 }
244 return false;
245 }
246
236 void LocationBarViewMac::UpdateOpenPDFInReaderPrompt() { 247 void LocationBarViewMac::UpdateOpenPDFInReaderPrompt() {
237 // Not implemented on Mac. 248 // Not implemented on Mac.
238 } 249 }
239 250
240 void LocationBarViewMac::UpdateGeneratedCreditCardView() { 251 void LocationBarViewMac::UpdateGeneratedCreditCardView() {
241 generated_credit_card_decoration_->Update(); 252 generated_credit_card_decoration_->Update();
242 } 253 }
243 254
244 void LocationBarViewMac::SaveStateToContents(WebContents* contents) { 255 void LocationBarViewMac::SaveStateToContents(WebContents* contents) {
245 // TODO(shess): Why SaveStateToContents vs SaveStateToTab? 256 // TODO(shess): Why SaveStateToContents vs SaveStateToTab?
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 639
629 Update(NULL); 640 Update(NULL);
630 } 641 }
631 642
632 void LocationBarViewMac::ModelChanged(const SearchModel::State& old_state, 643 void LocationBarViewMac::ModelChanged(const SearchModel::State& old_state,
633 const SearchModel::State& new_state) { 644 const SearchModel::State& new_state) {
634 if (UpdateMicSearchDecorationVisibility()) 645 if (UpdateMicSearchDecorationVisibility())
635 Layout(); 646 Layout();
636 } 647 }
637 648
638 void LocationBarViewMac::ActivatePageAction(const std::string& extension_id) {
639 for (size_t i = 0; i < page_action_decorations_.size(); ++i) {
640 if (page_action_decorations_[i]->page_action()->extension_id() ==
641 extension_id) {
642 page_action_decorations_[i]->ActivatePageAction();
643 return;
644 }
645 }
646 }
647
648 void LocationBarViewMac::PostNotification(NSString* notification) { 649 void LocationBarViewMac::PostNotification(NSString* notification) {
649 [[NSNotificationCenter defaultCenter] postNotificationName:notification 650 [[NSNotificationCenter defaultCenter] postNotificationName:notification
650 object:[NSValue valueWithPointer:this]]; 651 object:[NSValue valueWithPointer:this]];
651 } 652 }
652 653
653 PageActionDecoration* LocationBarViewMac::GetPageActionDecoration( 654 PageActionDecoration* LocationBarViewMac::GetPageActionDecoration(
654 ExtensionAction* page_action) { 655 ExtensionAction* page_action) {
655 DCHECK(page_action); 656 DCHECK(page_action);
656 for (size_t i = 0; i < page_action_decorations_.size(); ++i) { 657 for (size_t i = 0; i < page_action_decorations_.size(); ++i) {
657 if (page_action_decorations_[i]->page_action() == page_action) 658 if (page_action_decorations_[i]->page_action() == page_action)
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 } 778 }
778 779
779 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { 780 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() {
780 bool is_visible = !GetToolbarModel()->input_in_progress() && 781 bool is_visible = !GetToolbarModel()->input_in_progress() &&
781 browser_->search_model()->voice_search_supported(); 782 browser_->search_model()->voice_search_supported();
782 if (mic_search_decoration_->IsVisible() == is_visible) 783 if (mic_search_decoration_->IsVisible() == is_visible)
783 return false; 784 return false;
784 mic_search_decoration_->SetVisible(is_visible); 785 mic_search_decoration_->SetVisible(is_visible);
785 return true; 786 return true;
786 } 787 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698