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

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

Issue 1495653003: [Media Router] Check MediaRouterDialogControllerImpl only sets toolbar MediaRouterAction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes per pkasting@'s comments. Fixed OSX segfaults. Created 5 years 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/component_toolbar_actions_factory.h" 5 #include "chrome/browser/ui/toolbar/component_toolbar_actions_factory.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "chrome/browser/media/router/media_router_feature.h" 9 #include "chrome/browser/media/router/media_router_feature.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 if (!profile->IsOffTheRecord() && media_router::MediaRouterEnabled(profile)) 49 if (!profile->IsOffTheRecord() && media_router::MediaRouterEnabled(profile))
50 component_ids.insert(kMediaRouterActionId); 50 component_ids.insert(kMediaRouterActionId);
51 51
52 return component_ids; 52 return component_ids;
53 } 53 }
54 54
55 scoped_ptr<ToolbarActionViewController> 55 scoped_ptr<ToolbarActionViewController>
56 ComponentToolbarActionsFactory::GetComponentToolbarActionForId( 56 ComponentToolbarActionsFactory::GetComponentToolbarActionForId(
57 const std::string& id, 57 const std::string& id,
58 Browser* browser) { 58 Browser* browser,
59 ToolbarActionsBar* bar) {
59 // This is currently behind the extension-action-redesign flag, as it is 60 // This is currently behind the extension-action-redesign flag, as it is
60 // designed for the new toolbar. 61 // designed for the new toolbar.
61 DCHECK(extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()); 62 DCHECK(extensions::FeatureSwitch::extension_action_redesign()->IsEnabled());
62 DCHECK(GetInitialComponentIds(browser->profile()).count(id)); 63 DCHECK(GetInitialComponentIds(browser->profile()).count(id));
63 64
64 // Add component toolbar actions here. 65 // Add component toolbar actions here.
65 // This current design means that the ComponentToolbarActionsFactory is aware 66 // This current design means that the ComponentToolbarActionsFactory is aware
66 // of all actions. Since we should *not* have an excessive amount of these 67 // of all actions. Since we should *not* have an excessive amount of these
67 // (since each will have an action in the toolbar or overflow menu), this 68 // (since each will have an action in the toolbar or overflow menu), this
68 // should be okay. If this changes, we should rethink this design to have, 69 // should be okay. If this changes, we should rethink this design to have,
69 // e.g., RegisterChromeAction(). 70 // e.g., RegisterChromeAction().
70 #if defined(ENABLE_MEDIA_ROUTER) 71 #if defined(ENABLE_MEDIA_ROUTER)
71 if (id == kMediaRouterActionId) 72 if (id == kMediaRouterActionId)
72 return scoped_ptr<ToolbarActionViewController>( 73 return scoped_ptr<ToolbarActionViewController>(
73 new MediaRouterAction(browser)); 74 new MediaRouterAction(browser, bar));
74 #endif // defined(ENABLE_MEDIA_ROUTER) 75 #endif // defined(ENABLE_MEDIA_ROUTER)
75 76
76 NOTREACHED(); 77 NOTREACHED();
77 return scoped_ptr<ToolbarActionViewController>(); 78 return scoped_ptr<ToolbarActionViewController>();
78 } 79 }
79 80
80 // static 81 // static
81 void ComponentToolbarActionsFactory::SetTestingFactory( 82 void ComponentToolbarActionsFactory::SetTestingFactory(
82 ComponentToolbarActionsFactory* factory) { 83 ComponentToolbarActionsFactory* factory) {
83 testing_factory_ = factory; 84 testing_factory_ = factory;
84 } 85 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/component_toolbar_actions_factory.h ('k') | chrome/browser/ui/toolbar/media_router_action.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698