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.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::DevModeBubbleController* controller = |
| 245 extensions::DevModeBubbleController::Get( |
| 246 browser_->profile()); |
| 247 if (controller->IsDevModeExtension(extension_)) |
| 248 background_id = IDR_BROWSER_ACTION_HIGHLIGHT; |
| 249 |
| 250 gfx::ImageSkia bg = *theme->GetImageSkiaNamed(background_id); |
242 SetIcon(gfx::ImageSkiaOperations::CreateSuperimposedImage(bg, icon)); | 251 SetIcon(gfx::ImageSkiaOperations::CreateSuperimposedImage(bg, icon)); |
243 | 252 |
244 gfx::ImageSkia bg_h = *theme->GetImageSkiaNamed(IDR_BROWSER_ACTION_H); | 253 gfx::ImageSkia bg_h = *theme->GetImageSkiaNamed(IDR_BROWSER_ACTION_H); |
245 SetHoverIcon(gfx::ImageSkiaOperations::CreateSuperimposedImage(bg_h, icon)); | 254 SetHoverIcon(gfx::ImageSkiaOperations::CreateSuperimposedImage(bg_h, icon)); |
246 | 255 |
247 gfx::ImageSkia bg_p = *theme->GetImageSkiaNamed(IDR_BROWSER_ACTION_P); | 256 gfx::ImageSkia bg_p = *theme->GetImageSkiaNamed(IDR_BROWSER_ACTION_P); |
248 SetPushedIcon( | 257 SetPushedIcon( |
249 gfx::ImageSkiaOperations::CreateSuperimposedImage(bg_p, icon)); | 258 gfx::ImageSkiaOperations::CreateSuperimposedImage(bg_p, icon)); |
250 } | 259 } |
251 | 260 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 extensions::Command browser_action_command; | 429 extensions::Command browser_action_command; |
421 if (!only_if_active || !command_service->GetBrowserActionCommand( | 430 if (!only_if_active || !command_service->GetBrowserActionCommand( |
422 extension_->id(), | 431 extension_->id(), |
423 extensions::CommandService::ACTIVE_ONLY, | 432 extensions::CommandService::ACTIVE_ONLY, |
424 &browser_action_command, | 433 &browser_action_command, |
425 NULL)) { | 434 NULL)) { |
426 GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this); | 435 GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this); |
427 keybinding_.reset(NULL); | 436 keybinding_.reset(NULL); |
428 } | 437 } |
429 } | 438 } |
OLD | NEW |