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

Side by Side Diff: chrome/browser/views/browser_actions_container.cc

Issue 256022: Loads local resources from current locale subtree if available, if not it fal... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/net/file_reader_unittest.cc ('k') | chrome/browser/views/location_bar_view.h » ('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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-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/views/browser_actions_container.h" 5 #include "chrome/browser/views/browser_actions_container.h"
6 6
7 #include "app/gfx/canvas.h" 7 #include "app/gfx/canvas.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "chrome/browser/extensions/extension_browser_event_router.h" 10 #include "chrome/browser/extensions/extension_browser_event_router.h"
11 #include "chrome/browser/extensions/extensions_service.h" 11 #include "chrome/browser/extensions/extensions_service.h"
12 #include "chrome/browser/extensions/extension_tabs_module.h" 12 #include "chrome/browser/extensions/extension_tabs_module.h"
13 #include "chrome/browser/image_loading_tracker.h" 13 #include "chrome/browser/extensions/image_loading_tracker.h"
14 #include "chrome/browser/profile.h" 14 #include "chrome/browser/profile.h"
15 #include "chrome/browser/views/extensions/extension_popup.h" 15 #include "chrome/browser/views/extensions/extension_popup.h"
16 #include "chrome/browser/views/toolbar_view.h" 16 #include "chrome/browser/views/toolbar_view.h"
17 #include "chrome/common/extensions/extension_action.h" 17 #include "chrome/common/extensions/extension_action.h"
18 #include "chrome/common/notification_source.h" 18 #include "chrome/common/notification_source.h"
19 #include "chrome/common/notification_type.h" 19 #include "chrome/common/notification_type.h"
20 #include "grit/app_resources.h" 20 #include "grit/app_resources.h"
21 #include "third_party/skia/include/core/SkBitmap.h" 21 #include "third_party/skia/include/core/SkBitmap.h"
22 #include "third_party/skia/include/core/SkTypeface.h" 22 #include "third_party/skia/include/core/SkTypeface.h"
23 #include "third_party/skia/include/effects/SkGradientShader.h" 23 #include "third_party/skia/include/effects/SkGradientShader.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 // Load the images this view needs asynchronously on the file thread. We'll 124 // Load the images this view needs asynchronously on the file thread. We'll
125 // get a call back into OnImageLoaded if the image loads successfully. If not, 125 // get a call back into OnImageLoaded if the image loads successfully. If not,
126 // the ImageView will have no image and will not appear in the browser chrome. 126 // the ImageView will have no image and will not appear in the browser chrome.
127 DCHECK(!browser_action->icon_paths().empty()); 127 DCHECK(!browser_action->icon_paths().empty());
128 const std::vector<std::string>& icon_paths = browser_action->icon_paths(); 128 const std::vector<std::string>& icon_paths = browser_action->icon_paths();
129 browser_action_icons_.resize(icon_paths.size()); 129 browser_action_icons_.resize(icon_paths.size());
130 tracker_ = new ImageLoadingTracker(this, icon_paths.size()); 130 tracker_ = new ImageLoadingTracker(this, icon_paths.size());
131 for (std::vector<std::string>::const_iterator iter = icon_paths.begin(); 131 for (std::vector<std::string>::const_iterator iter = icon_paths.begin();
132 iter != icon_paths.end(); ++iter) { 132 iter != icon_paths.end(); ++iter) {
133 FilePath path = extension->GetResourcePath(*iter); 133 tracker_->PostLoadImageTask(extension->GetResource(*iter));
134 tracker_->PostLoadImageTask(path);
135 } 134 }
136 135
137 registrar_.Add(this, NotificationType::EXTENSION_BROWSER_ACTION_UPDATED, 136 registrar_.Add(this, NotificationType::EXTENSION_BROWSER_ACTION_UPDATED,
138 Source<ExtensionAction>(browser_action_)); 137 Source<ExtensionAction>(browser_action_));
139 } 138 }
140 139
141 BrowserActionImageView::~BrowserActionImageView() { 140 BrowserActionImageView::~BrowserActionImageView() {
142 if (tracker_) { 141 if (tracker_) {
143 tracker_->StopTrackingImageLoad(); 142 tracker_->StopTrackingImageLoad();
144 tracker_ = NULL; // The tracker object will be deleted when we return. 143 tracker_ = NULL; // The tracker object will be deleted when we return.
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 // text was too large. 493 // text was too large.
495 rect.fLeft += kPadding; 494 rect.fLeft += kPadding;
496 rect.fRight -= kPadding; 495 rect.fRight -= kPadding;
497 canvas->clipRect(rect); 496 canvas->clipRect(rect);
498 canvas->drawText(text.c_str(), text.size(), 497 canvas->drawText(text.c_str(), text.size(),
499 rect.fLeft + (rect.width() - text_width) / 2, 498 rect.fLeft + (rect.width() - text_width) / 2,
500 rect.fTop + kTextSize + 1, 499 rect.fTop + kTextSize + 1,
501 text_paint); 500 text_paint);
502 canvas->restore(); 501 canvas->restore();
503 } 502 }
OLDNEW
« no previous file with comments | « chrome/browser/net/file_reader_unittest.cc ('k') | chrome/browser/views/location_bar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698