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

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

Issue 1472863004: [MD] re-skin extension browser action badges (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile 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/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 14 matching lines...) Expand all
25 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_observer.h" 25 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_observer.h"
26 #include "chrome/common/pref_names.h" 26 #include "chrome/common/pref_names.h"
27 #include "components/crx_file/id_util.h" 27 #include "components/crx_file/id_util.h"
28 #include "components/pref_registry/pref_registry_syncable.h" 28 #include "components/pref_registry/pref_registry_syncable.h"
29 #include "extensions/browser/extension_registry.h" 29 #include "extensions/browser/extension_registry.h"
30 #include "extensions/browser/extension_system.h" 30 #include "extensions/browser/extension_system.h"
31 #include "extensions/browser/runtime_data.h" 31 #include "extensions/browser/runtime_data.h"
32 #include "extensions/common/extension.h" 32 #include "extensions/common/extension.h"
33 #include "extensions/common/feature_switch.h" 33 #include "extensions/common/feature_switch.h"
34 #include "grit/theme_resources.h" 34 #include "grit/theme_resources.h"
35 #include "ui/base/resource/material_design/material_design_controller.h"
35 #include "ui/base/resource/resource_bundle.h" 36 #include "ui/base/resource/resource_bundle.h"
36 #include "ui/gfx/image/image_skia.h" 37 #include "ui/gfx/image/image_skia.h"
37 38
38 namespace { 39 namespace {
39 40
40 using WeakToolbarActions = std::vector<ToolbarActionViewController*>; 41 using WeakToolbarActions = std::vector<ToolbarActionViewController*>;
41 42
42 // Matches ToolbarView::kStandardSpacing; 43 // Matches ToolbarView::kStandardSpacing;
43 const int kLeftPadding = 3; 44 const int kLeftPadding = 3;
44 const int kRightPadding = kLeftPadding; 45 const int kRightPadding = kLeftPadding;
45 const int kItemSpacing = kLeftPadding; 46 const int kItemSpacing = kLeftPadding;
46 const int kOverflowLeftPadding = kItemSpacing; 47 const int kOverflowLeftPadding = kItemSpacing;
47 const int kOverflowRightPadding = kItemSpacing; 48 const int kOverflowRightPadding = kItemSpacing;
48 49
49 enum DimensionType { WIDTH, HEIGHT }; 50 enum DimensionType { WIDTH, HEIGHT };
50 51
51 // Returns the width or height of the toolbar action icon size. 52 // Returns the width or height of the toolbar action icon size.
52 int GetIconDimension(DimensionType type) { 53 int GetIconDimension(DimensionType type) {
54 if (ui::MaterialDesignController::IsModeMaterial())
55 return 28;
Devlin 2015/12/01 21:06:42 Is this guaranteed to be the same across all platf
Evan Stade 2015/12/01 23:15:58 if you mean OSX vs. Windows, yes. I think it might
tdanderson 2015/12/02 00:57:10 Actually there is no difference between material a
56
53 static bool initialized = false; 57 static bool initialized = false;
54 static int icon_height = 0; 58 static int icon_height = 0;
55 static int icon_width = 0; 59 static int icon_width = 0;
56 if (!initialized) { 60 if (!initialized) {
57 initialized = true; 61 initialized = true;
58 gfx::ImageSkia* skia = 62 gfx::ImageSkia* skia =
59 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 63 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
60 IDR_BROWSER_ACTION); 64 IDR_BROWSER_ACTION);
61 icon_height = skia->height(); 65 icon_height = skia->height();
62 icon_width = skia->width(); 66 icon_width = skia->width();
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 for (ToolbarActionViewController* action : toolbar_actions_) { 798 for (ToolbarActionViewController* action : toolbar_actions_) {
795 if (action->GetId() == action_id) 799 if (action->GetId() == action_id)
796 return action; 800 return action;
797 } 801 }
798 return nullptr; 802 return nullptr;
799 } 803 }
800 804
801 content::WebContents* ToolbarActionsBar::GetCurrentWebContents() { 805 content::WebContents* ToolbarActionsBar::GetCurrentWebContents() {
802 return browser_->tab_strip_model()->GetActiveWebContents(); 806 return browser_->tab_strip_model()->GetActiveWebContents();
803 } 807 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/extensions/icon_with_badge_image_source.cc ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698