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

Side by Side Diff: chrome/browser/ui/app_list/extension_app_item.cc

Issue 671653002: Standardize usage of virtual/override/final in chrome/browser/ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months 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/ui/app_list/extension_app_item.h" 5 #include "chrome/browser/ui/app_list/extension_app_item.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/extensions/extension_util.h" 9 #include "chrome/browser/extensions/extension_util.h"
10 #include "chrome/browser/extensions/launch_util.h" 10 #include "chrome/browser/extensions/launch_util.h"
(...skipping 26 matching lines...) Expand all
37 37
38 namespace { 38 namespace {
39 39
40 // Overlays a shortcut icon over the bottom left corner of a given image. 40 // Overlays a shortcut icon over the bottom left corner of a given image.
41 class ShortcutOverlayImageSource : public gfx::CanvasImageSource { 41 class ShortcutOverlayImageSource : public gfx::CanvasImageSource {
42 public: 42 public:
43 explicit ShortcutOverlayImageSource(const gfx::ImageSkia& icon) 43 explicit ShortcutOverlayImageSource(const gfx::ImageSkia& icon)
44 : gfx::CanvasImageSource(icon.size(), false), 44 : gfx::CanvasImageSource(icon.size(), false),
45 icon_(icon) { 45 icon_(icon) {
46 } 46 }
47 virtual ~ShortcutOverlayImageSource() {} 47 ~ShortcutOverlayImageSource() override {}
48 48
49 private: 49 private:
50 // gfx::CanvasImageSource overrides: 50 // gfx::CanvasImageSource overrides:
51 virtual void Draw(gfx::Canvas* canvas) override { 51 void Draw(gfx::Canvas* canvas) override {
52 canvas->DrawImageInt(icon_, 0, 0); 52 canvas->DrawImageInt(icon_, 0, 0);
53 53
54 // Draw the overlay in the bottom left corner of the icon. 54 // Draw the overlay in the bottom left corner of the icon.
55 const gfx::ImageSkia& overlay = *ui::ResourceBundle::GetSharedInstance(). 55 const gfx::ImageSkia& overlay = *ui::ResourceBundle::GetSharedInstance().
56 GetImageSkiaNamed(IDR_APP_LIST_TAB_OVERLAY); 56 GetImageSkiaNamed(IDR_APP_LIST_TAB_OVERLAY);
57 canvas->DrawImageInt(overlay, 0, icon_.height() - overlay.height()); 57 canvas->DrawImageInt(overlay, 0, icon_.height() - overlay.height());
58 } 58 }
59 59
60 gfx::ImageSkia icon_; 60 gfx::ImageSkia icon_;
61 61
62 DISALLOW_COPY_AND_ASSIGN(ShortcutOverlayImageSource); 62 DISALLOW_COPY_AND_ASSIGN(ShortcutOverlayImageSource);
63 }; 63 };
64 64
65 // Rounds the corners of a given image. 65 // Rounds the corners of a given image.
66 class RoundedCornersImageSource : public gfx::CanvasImageSource { 66 class RoundedCornersImageSource : public gfx::CanvasImageSource {
67 public: 67 public:
68 explicit RoundedCornersImageSource(const gfx::ImageSkia& icon) 68 explicit RoundedCornersImageSource(const gfx::ImageSkia& icon)
69 : gfx::CanvasImageSource(icon.size(), false), 69 : gfx::CanvasImageSource(icon.size(), false),
70 icon_(icon) { 70 icon_(icon) {
71 } 71 }
72 virtual ~RoundedCornersImageSource() {} 72 ~RoundedCornersImageSource() override {}
73 73
74 private: 74 private:
75 // gfx::CanvasImageSource overrides: 75 // gfx::CanvasImageSource overrides:
76 virtual void Draw(gfx::Canvas* canvas) override { 76 void Draw(gfx::Canvas* canvas) override {
77 // The radius used to round the app icon. 77 // The radius used to round the app icon.
78 const size_t kRoundingRadius = 2; 78 const size_t kRoundingRadius = 2;
79 79
80 canvas->DrawImageInt(icon_, 0, 0); 80 canvas->DrawImageInt(icon_, 0, 0);
81 81
82 scoped_ptr<gfx::Canvas> masking_canvas( 82 scoped_ptr<gfx::Canvas> masking_canvas(
83 new gfx::Canvas(gfx::Size(icon_.width(), icon_.height()), 1.0f, false)); 83 new gfx::Canvas(gfx::Size(icon_.width(), icon_.height()), 1.0f, false));
84 DCHECK(masking_canvas); 84 DCHECK(masking_canvas);
85 85
86 SkPaint opaque_paint; 86 SkPaint opaque_paint;
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 const syncer::StringOrdinal& launch = 356 const syncer::StringOrdinal& launch =
357 GetAppSorting(profile_)->GetAppLaunchOrdinal(extension_id_); 357 GetAppSorting(profile_)->GetAppLaunchOrdinal(extension_id_);
358 set_position(syncer::StringOrdinal( 358 set_position(syncer::StringOrdinal(
359 page.ToInternalValue() + launch.ToInternalValue())); 359 page.ToInternalValue() + launch.ToInternalValue()));
360 } 360 }
361 361
362 AppListControllerDelegate* ExtensionAppItem::GetController() { 362 AppListControllerDelegate* ExtensionAppItem::GetController() {
363 return AppListService::Get(chrome::GetActiveDesktop())-> 363 return AppListService::Get(chrome::GetActiveDesktop())->
364 GetControllerDelegate(); 364 GetControllerDelegate();
365 } 365 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698