Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 #include "ui/gfx/image/image_skia.h" | 38 #include "ui/gfx/image/image_skia.h" |
| 39 | 39 |
| 40 namespace { | 40 namespace { |
| 41 | 41 |
| 42 using WeakToolbarActions = std::vector<ToolbarActionViewController*>; | 42 using WeakToolbarActions = std::vector<ToolbarActionViewController*>; |
| 43 | 43 |
| 44 enum DimensionType { WIDTH, HEIGHT }; | 44 enum DimensionType { WIDTH, HEIGHT }; |
| 45 | 45 |
| 46 // Returns the width or height of the toolbar action icon size. | 46 // Returns the width or height of the toolbar action icon size. |
| 47 int GetIconDimension(DimensionType type) { | 47 int GetIconDimension(DimensionType type) { |
| 48 #if defined(OS_MACOSX) | |
| 49 // On the Mac, the spec is a 24x24 button in a 28x28 space. | |
| 50 if (ui::MaterialDesignController::IsModeMaterial()) | |
| 51 return 24; | |
|
sky
2016/04/11 15:13:02
The conditional is the same, so move the ifdef ins
| |
| 52 #else | |
| 48 if (ui::MaterialDesignController::IsModeMaterial()) | 53 if (ui::MaterialDesignController::IsModeMaterial()) |
| 49 return 28; | 54 return 28; |
| 55 #endif | |
| 50 | 56 |
| 51 static bool initialized = false; | 57 static bool initialized = false; |
| 52 static int icon_height = 0; | 58 static int icon_height = 0; |
| 53 static int icon_width = 0; | 59 static int icon_width = 0; |
| 54 if (!initialized) { | 60 if (!initialized) { |
| 55 initialized = true; | 61 initialized = true; |
| 56 gfx::ImageSkia* skia = | 62 gfx::ImageSkia* skia = |
| 57 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 63 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 58 IDR_BROWSER_ACTION); | 64 IDR_BROWSER_ACTION); |
| 59 icon_height = skia->height(); | 65 icon_height = skia->height(); |
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 783 for (ToolbarActionViewController* action : toolbar_actions_) { | 789 for (ToolbarActionViewController* action : toolbar_actions_) { |
| 784 if (action->GetId() == action_id) | 790 if (action->GetId() == action_id) |
| 785 return action; | 791 return action; |
| 786 } | 792 } |
| 787 return nullptr; | 793 return nullptr; |
| 788 } | 794 } |
| 789 | 795 |
| 790 content::WebContents* ToolbarActionsBar::GetCurrentWebContents() { | 796 content::WebContents* ToolbarActionsBar::GetCurrentWebContents() { |
| 791 return browser_->tab_strip_model()->GetActiveWebContents(); | 797 return browser_->tab_strip_model()->GetActiveWebContents(); |
| 792 } | 798 } |
| OLD | NEW |