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

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

Issue 113443: ChromeCanvas->gfx::Canvas (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/extension_shelf.h ('k') | chrome/browser/gtk/download_item_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_shelf.h" 5 #include "chrome/browser/extensions/extension_shelf.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/browser.h" 8 #include "chrome/browser/browser.h"
9 #include "chrome/browser/extensions/extension.h" 9 #include "chrome/browser/extensions/extension.h"
10 #include "chrome/browser/extensions/extension_process_manager.h" 10 #include "chrome/browser/extensions/extension_process_manager.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 } 61 }
62 } 62 }
63 } 63 }
64 64
65 ExtensionShelf::~ExtensionShelf() { 65 ExtensionShelf::~ExtensionShelf() {
66 NotificationService* ns = NotificationService::current(); 66 NotificationService* ns = NotificationService::current();
67 ns->RemoveObserver(this, NotificationType::EXTENSIONS_LOADED, 67 ns->RemoveObserver(this, NotificationType::EXTENSIONS_LOADED,
68 NotificationService::AllSources()); 68 NotificationService::AllSources());
69 } 69 }
70 70
71 void ExtensionShelf::Paint(ChromeCanvas* canvas) { 71 void ExtensionShelf::Paint(gfx::Canvas* canvas) {
72 #if 0 72 #if 0
73 // TODO(erikkay) re-enable this when Glen has the gradient values worked out. 73 // TODO(erikkay) re-enable this when Glen has the gradient values worked out.
74 SkPaint paint; 74 SkPaint paint;
75 paint.setShader(skia::CreateGradientShader(0, 75 paint.setShader(skia::CreateGradientShader(0,
76 height(), 76 height(),
77 kTopGradientColor, 77 kTopGradientColor,
78 kBackgroundColor))->safeUnref(); 78 kBackgroundColor))->safeUnref();
79 canvas->FillRectInt(0, 0, width(), height(), paint); 79 canvas->FillRectInt(0, 0, width(), height(), paint);
80 #else 80 #else
81 canvas->FillRectInt(kBackgroundColor, 0, 0, width(), height()); 81 canvas->FillRectInt(kBackgroundColor, 0, 0, width(), height());
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 if (!had_views) 173 if (!had_views)
174 PreferredSizeChanged(); 174 PreferredSizeChanged();
175 } 175 }
176 return added_toolstrip; 176 return added_toolstrip;
177 } 177 }
178 178
179 bool ExtensionShelf::HasExtensionViews() { 179 bool ExtensionShelf::HasExtensionViews() {
180 return GetChildViewCount() > 0; 180 return GetChildViewCount() > 0;
181 } 181 }
182 182
183 void ExtensionShelf::InitBackground(ChromeCanvas* canvas, 183 void ExtensionShelf::InitBackground(gfx::Canvas* canvas,
184 const SkRect& subset) { 184 const SkRect& subset) {
185 if (!background_.empty()) 185 if (!background_.empty())
186 return; 186 return;
187 187
188 const SkBitmap& background = canvas->getDevice()->accessBitmap(false); 188 const SkBitmap& background = canvas->getDevice()->accessBitmap(false);
189 189
190 // Extract the correct subset of the toolstrip background into a bitmap. We 190 // Extract the correct subset of the toolstrip background into a bitmap. We
191 // must use a temporary here because extractSubset() returns a bitmap that 191 // must use a temporary here because extractSubset() returns a bitmap that
192 // references pixels in the original one and we want to actually make a copy 192 // references pixels in the original one and we want to actually make a copy
193 // that will have a long lifetime. 193 // that will have a long lifetime.
(...skipping 13 matching lines...) Expand all
207 return; 207 return;
208 208
209 temp.copyTo(&background_, temp.config()); 209 temp.copyTo(&background_, temp.config());
210 DCHECK(background_.readyToDraw()); 210 DCHECK(background_.readyToDraw());
211 211
212 // Tell all extension views about the new background 212 // Tell all extension views about the new background
213 int count = GetChildViewCount(); 213 int count = GetChildViewCount();
214 for (int i = 0; i < count; ++i) 214 for (int i = 0; i < count; ++i)
215 static_cast<ExtensionView*>(GetChildViewAt(i))->SetBackground(background_); 215 static_cast<ExtensionView*>(GetChildViewAt(i))->SetBackground(background_);
216 } 216 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_shelf.h ('k') | chrome/browser/gtk/download_item_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698