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

Side by Side Diff: chrome/browser/extensions/extension_action.cc

Issue 11361189: Initial skeleton for System Indicator API (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Clean up extension action arguments, style, smaller tests. Created 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extensions/extension_action.h" 5 #include "chrome/browser/extensions/extension_action.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 10 matching lines...) Expand all
21 #include "third_party/skia/include/effects/SkGradientShader.h" 21 #include "third_party/skia/include/effects/SkGradientShader.h"
22 #include "ui/base/animation/animation_delegate.h" 22 #include "ui/base/animation/animation_delegate.h"
23 #include "ui/base/resource/resource_bundle.h" 23 #include "ui/base/resource/resource_bundle.h"
24 #include "ui/gfx/canvas.h" 24 #include "ui/gfx/canvas.h"
25 #include "ui/gfx/color_utils.h" 25 #include "ui/gfx/color_utils.h"
26 #include "ui/gfx/image/canvas_image_source.h" 26 #include "ui/gfx/image/canvas_image_source.h"
27 #include "ui/gfx/image/image_skia.h" 27 #include "ui/gfx/image/image_skia.h"
28 #include "ui/gfx/image/image_skia_source.h" 28 #include "ui/gfx/image/image_skia_source.h"
29 #include "ui/gfx/rect.h" 29 #include "ui/gfx/rect.h"
30 #include "ui/gfx/size.h" 30 #include "ui/gfx/size.h"
31 #include "ui/gfx/image/image_skia_source.h"
32 #include "ui/gfx/skbitmap_operations.h" 31 #include "ui/gfx/skbitmap_operations.h"
33 32
34 namespace { 33 namespace {
35 34
36 // Different platforms need slightly different constants to look good. 35 // Different platforms need slightly different constants to look good.
37 #if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) 36 #if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS)
38 const float kTextSize = 9.0; 37 const float kTextSize = 9.0;
39 const int kBottomMarginBrowserAction = 0; 38 const int kBottomMarginBrowserAction = 0;
40 const int kBottomMarginPageAction = 2; 39 const int kBottomMarginPageAction = 2;
41 const int kPadding = 2; 40 const int kPadding = 2;
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 284
286 return copy.Pass(); 285 return copy.Pass();
287 } 286 }
288 287
289 // static 288 // static
290 int ExtensionAction::GetIconSizeForType( 289 int ExtensionAction::GetIconSizeForType(
291 extensions::Extension::ActionInfo::Type type) { 290 extensions::Extension::ActionInfo::Type type) {
292 switch (type) { 291 switch (type) {
293 case extensions::Extension::ActionInfo::TYPE_BROWSER: 292 case extensions::Extension::ActionInfo::TYPE_BROWSER:
294 case extensions::Extension::ActionInfo::TYPE_PAGE: 293 case extensions::Extension::ActionInfo::TYPE_PAGE:
294 case extensions::Extension::ActionInfo::TYPE_SYSTEM_INDICATOR:
295 // TODO(dewittj) Report the actual icon size of the system
296 // indicator.
295 return extension_misc::EXTENSION_ICON_ACTION; 297 return extension_misc::EXTENSION_ICON_ACTION;
296 case extensions::Extension::ActionInfo::TYPE_SCRIPT_BADGE: 298 case extensions::Extension::ActionInfo::TYPE_SCRIPT_BADGE:
297 return extension_misc::EXTENSION_ICON_BITTY; 299 return extension_misc::EXTENSION_ICON_BITTY;
298 default: 300 default:
299 NOTREACHED(); 301 NOTREACHED();
300 return 0; 302 return 0;
301 } 303 }
302 } 304 }
303 305
304 void ExtensionAction::SetPopupUrl(int tab_id, const GURL& url) { 306 void ExtensionAction::SetPopupUrl(int tab_id, const GURL& url) {
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 icon_animation->Start(); 547 icon_animation->Start();
546 // After the icon is finished fading in (plus some padding to handle random 548 // After the icon is finished fading in (plus some padding to handle random
547 // timer delays), destroy it. We use a delayed task so that the Animation is 549 // timer delays), destroy it. We use a delayed task so that the Animation is
548 // deleted even if it hasn't finished by the time the MessageLoop is 550 // deleted even if it hasn't finished by the time the MessageLoop is
549 // destroyed. 551 // destroyed.
550 MessageLoop::current()->PostDelayedTask( 552 MessageLoop::current()->PostDelayedTask(
551 FROM_HERE, 553 FROM_HERE,
552 base::Bind(&DestroyIconAnimation, base::Passed(icon_animation.Pass())), 554 base::Bind(&DestroyIconAnimation, base::Passed(icon_animation.Pass())),
553 base::TimeDelta::FromMilliseconds(kIconFadeInDurationMs * 2)); 555 base::TimeDelta::FromMilliseconds(kIconFadeInDurationMs * 2));
554 } 556 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698