Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: chrome/browser/ui/views/toolbar/browser_action_view.cc

Issue 95133002: Add an extension bubble explaining which extensions are in dev mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync'ed Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 if (extension_->IsDevModeExtension()) {
245 // We only want to call out dev mode extensions while the bubble is up.
246 extensions::DevModeBubbleController* dev_mode_extensions =
247 extensions::DevModeBubbleController::Get(
248 browser_->profile());
249 if (dev_mode_extensions->showing_bubble()) {
250 ExtensionService* service = extensions::ExtensionSystem::Get(
251 browser_->profile())->extension_service();
252 extensions::ExtensionPrefs* prefs = service->extension_prefs();
253 if (!prefs->HasDevModeBeenAcknowledged(extension_->id()))
254 background_id = IDR_BROWSER_ACTION_HIGHLIGHT;
255 }
256 }
257 gfx::ImageSkia bg = *theme->GetImageSkiaNamed(background_id);
242 SetIcon(gfx::ImageSkiaOperations::CreateSuperimposedImage(bg, icon)); 258 SetIcon(gfx::ImageSkiaOperations::CreateSuperimposedImage(bg, icon));
243 259
244 gfx::ImageSkia bg_h = *theme->GetImageSkiaNamed(IDR_BROWSER_ACTION_H); 260 gfx::ImageSkia bg_h = *theme->GetImageSkiaNamed(IDR_BROWSER_ACTION_H);
245 SetHoverIcon(gfx::ImageSkiaOperations::CreateSuperimposedImage(bg_h, icon)); 261 SetHoverIcon(gfx::ImageSkiaOperations::CreateSuperimposedImage(bg_h, icon));
246 262
247 gfx::ImageSkia bg_p = *theme->GetImageSkiaNamed(IDR_BROWSER_ACTION_P); 263 gfx::ImageSkia bg_p = *theme->GetImageSkiaNamed(IDR_BROWSER_ACTION_P);
248 SetPushedIcon( 264 SetPushedIcon(
249 gfx::ImageSkiaOperations::CreateSuperimposedImage(bg_p, icon)); 265 gfx::ImageSkiaOperations::CreateSuperimposedImage(bg_p, icon));
250 } 266 }
251 267
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 extensions::Command browser_action_command; 435 extensions::Command browser_action_command;
420 if (!only_if_active || !command_service->GetBrowserActionCommand( 436 if (!only_if_active || !command_service->GetBrowserActionCommand(
421 extension_->id(), 437 extension_->id(),
422 extensions::CommandService::ACTIVE_ONLY, 438 extensions::CommandService::ACTIVE_ONLY,
423 &browser_action_command, 439 &browser_action_command,
424 NULL)) { 440 NULL)) {
425 GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this); 441 GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this);
426 keybinding_.reset(NULL); 442 keybinding_.reset(NULL);
427 } 443 }
428 } 444 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698