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

Side by Side Diff: chrome/browser/ui/toolbar/toolbar_actions_bar.cc

Issue 1168383002: Implement sidebar support for extension action popups Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/toolbar/toolbar_actions_bar.h" 5 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/profiler/scoped_tracker.h" 8 #include "base/profiler/scoped_tracker.h"
9 #include "chrome/browser/extensions/extension_action_manager.h" 9 #include "chrome/browser/extensions/extension_action_manager.h"
10 #include "chrome/browser/extensions/extension_message_bubble_controller.h" 10 #include "chrome/browser/extensions/extension_message_bubble_controller.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 ToolbarActionsBar::ToolbarActionsBar(ToolbarActionsBarDelegate* delegate, 114 ToolbarActionsBar::ToolbarActionsBar(ToolbarActionsBarDelegate* delegate,
115 Browser* browser, 115 Browser* browser,
116 ToolbarActionsBar* main_bar) 116 ToolbarActionsBar* main_bar)
117 : delegate_(delegate), 117 : delegate_(delegate),
118 browser_(browser), 118 browser_(browser),
119 model_(extensions::ExtensionToolbarModel::Get(browser_->profile())), 119 model_(extensions::ExtensionToolbarModel::Get(browser_->profile())),
120 main_bar_(main_bar), 120 main_bar_(main_bar),
121 platform_settings_(main_bar != nullptr), 121 platform_settings_(main_bar != nullptr),
122 popup_owner_(nullptr), 122 popup_owner_(nullptr),
123 sidebar_owner_(nullptr),
123 model_observer_(this), 124 model_observer_(this),
124 suppress_layout_(false), 125 suppress_layout_(false),
125 suppress_animation_(true), 126 suppress_animation_(true),
126 overflowed_action_wants_to_run_(false), 127 overflowed_action_wants_to_run_(false),
127 checked_extension_bubble_(false), 128 checked_extension_bubble_(false),
128 popped_out_action_(nullptr), 129 popped_out_action_(nullptr),
129 weak_ptr_factory_(this) { 130 weak_ptr_factory_(this) {
130 if (model_) // |model_| can be null in unittests. 131 if (model_) // |model_| can be null in unittests.
131 model_observer_.Add(model_); 132 model_observer_.Add(model_);
132 } 133 }
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 (popup_owner_ && !popup_owner)); 499 (popup_owner_ && !popup_owner));
499 popup_owner_ = popup_owner; 500 popup_owner_ = popup_owner;
500 } 501 }
501 502
502 void ToolbarActionsBar::HideActivePopup() { 503 void ToolbarActionsBar::HideActivePopup() {
503 if (popup_owner_) 504 if (popup_owner_)
504 popup_owner_->HidePopup(); 505 popup_owner_->HidePopup();
505 DCHECK(!popup_owner_); 506 DCHECK(!popup_owner_);
506 } 507 }
507 508
509 void ToolbarActionsBar::SetSidebarOwner(
510 ToolbarActionViewController* sidebar_owner) {
511 // We should never be setting a popup owner when one already exists, and
512 // never unsetting one when one wasn't set.
513 DCHECK((!sidebar_owner_ && sidebar_owner) ||
514 (sidebar_owner_ && !sidebar_owner));
515 sidebar_owner_ = sidebar_owner;
516 }
517
518 void ToolbarActionsBar::HideActiveSidebar() {
519 if (sidebar_owner_)
520 sidebar_owner_->HideSidebar();
521 DCHECK(!sidebar_owner_);
522 }
523
508 ToolbarActionViewController* ToolbarActionsBar::GetMainControllerForAction( 524 ToolbarActionViewController* ToolbarActionsBar::GetMainControllerForAction(
509 ToolbarActionViewController* action) { 525 ToolbarActionViewController* action) {
510 return in_overflow_mode() ? 526 return in_overflow_mode() ?
511 main_bar_->GetActionForId(action->GetId()) : action; 527 main_bar_->GetActionForId(action->GetId()) : action;
512 } 528 }
513 529
514 void ToolbarActionsBar::MaybeShowExtensionBubble( 530 void ToolbarActionsBar::MaybeShowExtensionBubble(
515 scoped_ptr<extensions::ExtensionMessageBubbleController> controller) { 531 scoped_ptr<extensions::ExtensionMessageBubbleController> controller) {
516 controller->HighlightExtensionsIfNecessary(); // Safe to call multiple times. 532 controller->HighlightExtensionsIfNecessary(); // Safe to call multiple times.
517 if (delegate_->IsAnimating()) { 533 if (delegate_->IsAnimating()) {
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 for (ToolbarActionViewController* action : toolbar_actions_) { 752 for (ToolbarActionViewController* action : toolbar_actions_) {
737 if (action->GetId() == id) 753 if (action->GetId() == id)
738 return action; 754 return action;
739 } 755 }
740 return nullptr; 756 return nullptr;
741 } 757 }
742 758
743 content::WebContents* ToolbarActionsBar::GetCurrentWebContents() { 759 content::WebContents* ToolbarActionsBar::GetCurrentWebContents() {
744 return browser_->tab_strip_model()->GetActiveWebContents(); 760 return browser_->tab_strip_model()->GetActiveWebContents();
745 } 761 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698