OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/views/toolbar/toolbar_action_view.h" | 5 #include "chrome/browser/ui/views/toolbar/toolbar_action_view.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
151 } else if (state() == views::CustomButton::STATE_DISABLED) { | 151 } else if (state() == views::CustomButton::STATE_DISABLED) { |
152 SetState(views::CustomButton::STATE_NORMAL); | 152 SetState(views::CustomButton::STATE_NORMAL); |
153 } | 153 } |
154 | 154 |
155 wants_to_run_ = view_controller_->WantsToRun(web_contents); | 155 wants_to_run_ = view_controller_->WantsToRun(web_contents); |
156 | 156 |
157 gfx::ImageSkia icon( | 157 gfx::ImageSkia icon( |
158 view_controller_->GetIcon(web_contents, | 158 view_controller_->GetIcon(web_contents, |
159 GetPreferredSize()).AsImageSkia()); | 159 GetPreferredSize()).AsImageSkia()); |
160 | 160 |
161 if (!icon.isNull()) { | 161 if (!icon.isNull()) |
162 gfx::ImageSkia bg = *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 162 SetImage(views::Button::STATE_NORMAL, icon); |
Evan Stade
2016/01/13 18:35:41
this wasn't doing anything (except enlarging the i
Devlin
2016/01/13 19:58:12
Hmm... my guess is that maybe we *needed* to enlar
Evan Stade
2016/01/14 01:59:19
my personal guess is that the background asset use
| |
163 IDR_BROWSER_ACTION); | |
164 SetImage(views::Button::STATE_NORMAL, | |
165 gfx::ImageSkiaOperations::CreateSuperimposedImage(bg, icon)); | |
166 } | |
167 | 163 |
168 SetTooltipText(view_controller_->GetTooltip(web_contents)); | 164 SetTooltipText(view_controller_->GetTooltip(web_contents)); |
169 SetAccessibleName(view_controller_->GetAccessibleName(web_contents)); | 165 SetAccessibleName(view_controller_->GetAccessibleName(web_contents)); |
170 | 166 |
171 Layout(); // We need to layout since we may have added an icon as a result. | 167 Layout(); // We need to layout since we may have added an icon as a result. |
172 SchedulePaint(); | 168 SchedulePaint(); |
173 } | 169 } |
174 | 170 |
175 void ToolbarActionView::OnMenuButtonClicked(views::View* sender, | 171 void ToolbarActionView::OnMenuButtonClicked(views::View* sender, |
176 const gfx::Point& point) { | 172 const gfx::Point& point) { |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
361 if (menu_controller->in_nested_run()) { | 357 if (menu_controller->in_nested_run()) { |
362 // There is another menu showing. Close the outermost menu (since we are | 358 // There is another menu showing. Close the outermost menu (since we are |
363 // shown in the same menu, we don't want to close the whole thing). | 359 // shown in the same menu, we don't want to close the whole thing). |
364 menu_controller->Cancel(views::MenuController::EXIT_OUTERMOST); | 360 menu_controller->Cancel(views::MenuController::EXIT_OUTERMOST); |
365 return true; | 361 return true; |
366 } | 362 } |
367 } | 363 } |
368 | 364 |
369 return false; | 365 return false; |
370 } | 366 } |
OLD | NEW |