| 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 (ui::MaterialDesignController::IsModeMaterial()) | 48 if (ui::MaterialDesignController::IsModeMaterial()) |
| 49 #if defined(OS_MACOSX) |
| 50 // On the Mac, the spec is a 24x24 button in a 28x28 space. |
| 51 return 24; |
| 52 #else |
| 49 return 28; | 53 return 28; |
| 54 #endif |
| 50 | 55 |
| 51 static bool initialized = false; | 56 static bool initialized = false; |
| 52 static int icon_height = 0; | 57 static int icon_height = 0; |
| 53 static int icon_width = 0; | 58 static int icon_width = 0; |
| 54 if (!initialized) { | 59 if (!initialized) { |
| 55 initialized = true; | 60 initialized = true; |
| 56 gfx::ImageSkia* skia = | 61 gfx::ImageSkia* skia = |
| 57 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 62 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 58 IDR_BROWSER_ACTION); | 63 IDR_BROWSER_ACTION); |
| 59 icon_height = skia->height(); | 64 icon_height = skia->height(); |
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 for (ToolbarActionViewController* action : toolbar_actions_) { | 788 for (ToolbarActionViewController* action : toolbar_actions_) { |
| 784 if (action->GetId() == action_id) | 789 if (action->GetId() == action_id) |
| 785 return action; | 790 return action; |
| 786 } | 791 } |
| 787 return nullptr; | 792 return nullptr; |
| 788 } | 793 } |
| 789 | 794 |
| 790 content::WebContents* ToolbarActionsBar::GetCurrentWebContents() { | 795 content::WebContents* ToolbarActionsBar::GetCurrentWebContents() { |
| 791 return browser_->tab_strip_model()->GetActiveWebContents(); | 796 return browser_->tab_strip_model()->GetActiveWebContents(); |
| 792 } | 797 } |
| OLD | NEW |