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

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

Issue 1228223002: Close wrench menu when Media Router Action clicked in Views. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 5 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/location.h" 8 #include "base/location.h"
9 #include "base/profiler/scoped_tracker.h" 9 #include "base/profiler/scoped_tracker.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 size_t num_extension_actions = 0u; 262 size_t num_extension_actions = 0u;
263 for (ToolbarActionViewController* action : toolbar_actions_) { 263 for (ToolbarActionViewController* action : toolbar_actions_) {
264 // No component action should ever have a valid extension id, so we can 264 // No component action should ever have a valid extension id, so we can
265 // use this to check the extension amount. 265 // use this to check the extension amount.
266 if (crx_file::id_util::IdIsValid(action->GetId())) 266 if (crx_file::id_util::IdIsValid(action->GetId()))
267 ++num_extension_actions; 267 ++num_extension_actions;
268 } 268 }
269 269
270 int num_component_actions = 270 int num_component_actions =
271 ComponentToolbarActionsFactory::GetInstance()-> 271 ComponentToolbarActionsFactory::GetInstance()->
272 GetNumComponentActions(); 272 GetNumComponentActions(browser_);
273 size_t num_total_actions = num_extension_actions + num_component_actions; 273 size_t num_total_actions = num_extension_actions + num_component_actions;
274 274
275 DCHECK_LE(visible_icons, num_total_actions); 275 DCHECK_LE(visible_icons, num_total_actions);
276 DCHECK_EQ(model_->toolbar_items().size(), num_extension_actions); 276 DCHECK_EQ(model_->toolbar_items().size(), num_extension_actions);
277 } 277 }
278 #endif 278 #endif
279 279
280 return visible_icons; 280 return visible_icons;
281 } 281 }
282 282
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 // actions are being highlighted. 335 // actions are being highlighted.
336 if (!model_->is_highlighting()) { 336 if (!model_->is_highlighting()) {
337 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/463337 337 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/463337
338 // is fixed. 338 // is fixed.
339 tracked_objects::ScopedTracker tracking_profile2( 339 tracked_objects::ScopedTracker tracking_profile2(
340 FROM_HERE_WITH_EXPLICIT_FUNCTION( 340 FROM_HERE_WITH_EXPLICIT_FUNCTION(
341 "ToolbarActionsBar::CreateActions2")); 341 "ToolbarActionsBar::CreateActions2"));
342 342
343 ScopedVector<ToolbarActionViewController> component_actions = 343 ScopedVector<ToolbarActionViewController> component_actions =
344 ComponentToolbarActionsFactory::GetInstance()-> 344 ComponentToolbarActionsFactory::GetInstance()->
345 GetComponentToolbarActions(); 345 GetComponentToolbarActions(browser_);
346 DCHECK(component_actions.empty() || 346 DCHECK(component_actions.empty() ||
347 extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()); 347 extensions::FeatureSwitch::extension_action_redesign()->IsEnabled());
348 toolbar_actions_.insert(toolbar_actions_.end(), 348 toolbar_actions_.insert(toolbar_actions_.end(),
349 component_actions.begin(), 349 component_actions.begin(),
350 component_actions.end()); 350 component_actions.end());
351 component_actions.weak_clear(); 351 component_actions.weak_clear();
352 } 352 }
353 353
354 if (!toolbar_actions_.empty()) { 354 if (!toolbar_actions_.empty()) {
355 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/463337 355 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/463337
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 for (ToolbarActionViewController* action : toolbar_actions_) { 738 for (ToolbarActionViewController* action : toolbar_actions_) {
739 if (action->GetId() == id) 739 if (action->GetId() == id)
740 return action; 740 return action;
741 } 741 }
742 return nullptr; 742 return nullptr;
743 } 743 }
744 744
745 content::WebContents* ToolbarActionsBar::GetCurrentWebContents() { 745 content::WebContents* ToolbarActionsBar::GetCurrentWebContents() {
746 return browser_->tab_strip_model()->GetActiveWebContents(); 746 return browser_->tab_strip_model()->GetActiveWebContents();
747 } 747 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/media_router_action_platform_delegate.cc ('k') | chrome/browser/ui/toolbar/wrench_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698