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

Side by Side Diff: chrome/browser/ui/views/script_bubble_view.cc

Issue 12578008: Move CrxFile, FileReader, ExtensionResource to src/extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 9 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
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/views/script_bubble_view.h" 5 #include "chrome/browser/ui/views/script_bubble_view.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/extensions/extension_system.h" 9 #include "chrome/browser/extensions/extension_system.h"
10 #include "chrome/browser/extensions/image_loader.h" 10 #include "chrome/browser/extensions/image_loader.h"
11 #include "chrome/browser/extensions/script_bubble_controller.h" 11 #include "chrome/browser/extensions/script_bubble_controller.h"
12 #include "chrome/browser/extensions/tab_helper.h" 12 #include "chrome/browser/extensions/tab_helper.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/common/extensions/api/icons/icons_handler.h" 14 #include "chrome/common/extensions/api/icons/icons_handler.h"
15 #include "chrome/common/extensions/extension.h" 15 #include "chrome/common/extensions/extension.h"
16 #include "chrome/common/url_constants.h" 16 #include "chrome/common/url_constants.h"
17 #include "content/public/browser/page_navigator.h" 17 #include "content/public/browser/page_navigator.h"
18 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
19 #include "extensions/common/extension_resource.h"
19 #include "grit/generated_resources.h" 20 #include "grit/generated_resources.h"
20 #include "grit/locale_settings.h" 21 #include "grit/locale_settings.h"
21 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
22 #include "ui/views/controls/image_view.h" 23 #include "ui/views/controls/image_view.h"
23 #include "ui/views/controls/label.h" 24 #include "ui/views/controls/label.h"
24 #include "ui/views/controls/link.h" 25 #include "ui/views/controls/link.h"
25 #include "ui/views/layout/grid_layout.h" 26 #include "ui/views/layout/grid_layout.h"
26 #include "ui/views/widget/widget.h" 27 #include "ui/views/widget/widget.h"
27 28
28 using content::OpenURLParams; 29 using content::OpenURLParams;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // We specify |true| to get disabled extensions as well, since content 75 // We specify |true| to get disabled extensions as well, since content
75 // scripts survive their extensions being disabled. 76 // scripts survive their extensions being disabled.
76 const Extension* extension = 77 const Extension* extension =
77 extension_service->GetExtensionById(*iter, true); 78 extension_service->GetExtensionById(*iter, true);
78 ScriptEntry entry; 79 ScriptEntry entry;
79 entry.extension_id = *iter; 80 entry.extension_id = *iter;
80 entry.extension_name = UTF8ToUTF16(extension->name()); 81 entry.extension_name = UTF8ToUTF16(extension->name());
81 entries_.push_back(entry); 82 entries_.push_back(entry);
82 83
83 int size = extension_misc::EXTENSION_ICON_BITTY; 84 int size = extension_misc::EXTENSION_ICON_BITTY;
84 ExtensionResource image = 85 extensions::ExtensionResource image =
85 extensions::IconsInfo::GetIconResource(extension, 86 extensions::IconsInfo::GetIconResource(extension,
86 size, 87 size,
87 ExtensionIconSet::MATCH_BIGGER); 88 ExtensionIconSet::MATCH_BIGGER);
88 extensions::ImageLoader::Get(profile)->LoadImageAsync( 89 extensions::ImageLoader::Get(profile)->LoadImageAsync(
89 extension, image, gfx::Size(size, size), 90 extension, image, gfx::Size(size, size),
90 base::Bind(&ScriptBubbleView::OnImageLoaded, AsWeakPtr(), i)); 91 base::Bind(&ScriptBubbleView::OnImageLoaded, AsWeakPtr(), i));
91 } 92 }
92 } 93 }
93 94
94 ScriptBubbleView::~ScriptBubbleView() { 95 ScriptBubbleView::~ScriptBubbleView() {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 const gfx::ImageSkia* image_skia = image.ToImageSkia(); 192 const gfx::ImageSkia* image_skia = image.ToImageSkia();
192 entries_[index].extension_imageview->SetImage(image_skia); 193 entries_[index].extension_imageview->SetImage(image_skia);
193 } 194 }
194 } 195 }
195 196
196 ScriptBubbleController* ScriptBubbleView::GetScriptBubbleController() { 197 ScriptBubbleController* ScriptBubbleView::GetScriptBubbleController() {
197 extensions::TabHelper* extensions_tab_helper = 198 extensions::TabHelper* extensions_tab_helper =
198 extensions::TabHelper::FromWebContents(web_contents_); 199 extensions::TabHelper::FromWebContents(web_contents_);
199 return extensions_tab_helper->script_bubble_controller(); 200 return extensions_tab_helper->script_bubble_controller();
200 } 201 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/page_action_image_view.cc ('k') | chrome/browser/ui/web_applications/web_app_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698