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/browser_action_view.h" | 5 #include "chrome/browser/ui/views/toolbar/browser_action_view.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/extensions/api/commands/command_service.h" | 9 #include "chrome/browser/extensions/api/commands/command_service.h" |
| 10 #include "chrome/browser/extensions/dev_mode_bubble_controller_delegate.h" |
10 #include "chrome/browser/extensions/extension_action.h" | 11 #include "chrome/browser/extensions/extension_action.h" |
11 #include "chrome/browser/extensions/extension_action_manager.h" | 12 #include "chrome/browser/extensions/extension_action_manager.h" |
12 #include "chrome/browser/extensions/extension_context_menu_model.h" | 13 #include "chrome/browser/extensions/extension_context_menu_model.h" |
| 14 #include "chrome/browser/extensions/extension_service.h" |
13 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/themes/theme_service.h" | 16 #include "chrome/browser/themes/theme_service.h" |
15 #include "chrome/browser/themes/theme_service_factory.h" | 17 #include "chrome/browser/themes/theme_service_factory.h" |
16 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" | 19 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
18 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 20 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
19 #include "extensions/common/extension.h" | 21 #include "extensions/common/extension.h" |
20 #include "extensions/common/manifest_constants.h" | 22 #include "extensions/common/manifest_constants.h" |
21 #include "grit/generated_resources.h" | 23 #include "grit/generated_resources.h" |
22 #include "grit/theme_resources.h" | 24 #include "grit/theme_resources.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 233 |
232 gfx::ImageSkia icon = *icon_factory_.GetIcon(tab_id).ToImageSkia(); | 234 gfx::ImageSkia icon = *icon_factory_.GetIcon(tab_id).ToImageSkia(); |
233 | 235 |
234 if (!icon.isNull()) { | 236 if (!icon.isNull()) { |
235 if (!browser_action()->GetIsVisible(tab_id)) | 237 if (!browser_action()->GetIsVisible(tab_id)) |
236 icon = gfx::ImageSkiaOperations::CreateTransparentImage(icon, .25); | 238 icon = gfx::ImageSkiaOperations::CreateTransparentImage(icon, .25); |
237 | 239 |
238 ThemeService* theme = | 240 ThemeService* theme = |
239 ThemeServiceFactory::GetForProfile(browser_->profile()); | 241 ThemeServiceFactory::GetForProfile(browser_->profile()); |
240 | 242 |
241 gfx::ImageSkia bg = *theme->GetImageSkiaNamed(IDR_BROWSER_ACTION); | 243 int background_id = IDR_BROWSER_ACTION; |
| 244 extensions::DevModeBubbleControllerDelegate* delegate = |
| 245 extensions::DevModeBubbleControllerDelegate::Get( |
| 246 browser_->profile()); |
| 247 // We only want to call out dev mode extensions while the bubble is up. |
| 248 if (delegate->ShowingBubble() && |
| 249 delegate->IsDevModeExtension(extension_)) |
| 250 background_id = IDR_BROWSER_ACTION_HIGHLIGHT; |
| 251 |
| 252 gfx::ImageSkia bg = *theme->GetImageSkiaNamed(background_id); |
242 SetIcon(gfx::ImageSkiaOperations::CreateSuperimposedImage(bg, icon)); | 253 SetIcon(gfx::ImageSkiaOperations::CreateSuperimposedImage(bg, icon)); |
243 | 254 |
244 gfx::ImageSkia bg_h = *theme->GetImageSkiaNamed(IDR_BROWSER_ACTION_H); | 255 gfx::ImageSkia bg_h = *theme->GetImageSkiaNamed(IDR_BROWSER_ACTION_H); |
245 SetHoverIcon(gfx::ImageSkiaOperations::CreateSuperimposedImage(bg_h, icon)); | 256 SetHoverIcon(gfx::ImageSkiaOperations::CreateSuperimposedImage(bg_h, icon)); |
246 | 257 |
247 gfx::ImageSkia bg_p = *theme->GetImageSkiaNamed(IDR_BROWSER_ACTION_P); | 258 gfx::ImageSkia bg_p = *theme->GetImageSkiaNamed(IDR_BROWSER_ACTION_P); |
248 SetPushedIcon( | 259 SetPushedIcon( |
249 gfx::ImageSkiaOperations::CreateSuperimposedImage(bg_p, icon)); | 260 gfx::ImageSkiaOperations::CreateSuperimposedImage(bg_p, icon)); |
250 } | 261 } |
251 | 262 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 extensions::Command browser_action_command; | 430 extensions::Command browser_action_command; |
420 if (!only_if_active || !command_service->GetBrowserActionCommand( | 431 if (!only_if_active || !command_service->GetBrowserActionCommand( |
421 extension_->id(), | 432 extension_->id(), |
422 extensions::CommandService::ACTIVE_ONLY, | 433 extensions::CommandService::ACTIVE_ONLY, |
423 &browser_action_command, | 434 &browser_action_command, |
424 NULL)) { | 435 NULL)) { |
425 GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this); | 436 GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this); |
426 keybinding_.reset(NULL); | 437 keybinding_.reset(NULL); |
427 } | 438 } |
428 } | 439 } |
OLD | NEW |