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

Side by Side Diff: chrome/browser/extensions/extension_web_ui.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/extensions/extension_web_ui.h" 5 #include "chrome/browser/extensions/extension_web_ui.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/browser/extensions/api/bookmark_manager_private/bookmark_manage r_private_api.h" 14 #include "chrome/browser/extensions/api/bookmark_manager_private/bookmark_manage r_private_api.h"
15 #include "chrome/browser/extensions/extension_service.h" 15 #include "chrome/browser/extensions/extension_service.h"
16 #include "chrome/browser/extensions/extension_tab_util.h" 16 #include "chrome/browser/extensions/extension_tab_util.h"
17 #include "chrome/browser/extensions/image_loader.h" 17 #include "chrome/browser/extensions/image_loader.h"
18 #include "chrome/browser/favicon/favicon_util.h" 18 #include "chrome/browser/favicon/favicon_util.h"
19 #include "chrome/browser/prefs/scoped_user_pref_update.h" 19 #include "chrome/browser/prefs/scoped_user_pref_update.h"
20 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/common/chrome_switches.h" 21 #include "chrome/common/chrome_switches.h"
22 #include "chrome/common/extensions/api/icons/icons_handler.h" 22 #include "chrome/common/extensions/api/icons/icons_handler.h"
23 #include "chrome/common/extensions/extension.h" 23 #include "chrome/common/extensions/extension.h"
24 #include "chrome/common/extensions/extension_constants.h" 24 #include "chrome/common/extensions/extension_constants.h"
25 #include "chrome/common/extensions/extension_icon_set.h" 25 #include "chrome/common/extensions/extension_icon_set.h"
26 #include "chrome/common/extensions/extension_resource.h"
27 #include "chrome/common/url_constants.h" 26 #include "chrome/common/url_constants.h"
28 #include "components/user_prefs/pref_registry_syncable.h" 27 #include "components/user_prefs/pref_registry_syncable.h"
29 #include "content/public/browser/navigation_controller.h" 28 #include "content/public/browser/navigation_controller.h"
30 #include "content/public/browser/web_contents.h" 29 #include "content/public/browser/web_contents.h"
31 #include "content/public/browser/web_ui.h" 30 #include "content/public/browser/web_ui.h"
32 #include "content/public/common/bindings_policy.h" 31 #include "content/public/common/bindings_policy.h"
33 #include "content/public/common/page_transition_types.h" 32 #include "content/public/common/page_transition_types.h"
33 #include "extensions/common/extension_resource.h"
34 #include "net/base/file_stream.h" 34 #include "net/base/file_stream.h"
35 #include "third_party/skia/include/core/SkBitmap.h" 35 #include "third_party/skia/include/core/SkBitmap.h"
36 #include "ui/gfx/codec/png_codec.h" 36 #include "ui/gfx/codec/png_codec.h"
37 #include "ui/gfx/favicon_size.h" 37 #include "ui/gfx/favicon_size.h"
38 #include "ui/gfx/image/image_skia.h" 38 #include "ui/gfx/image/image_skia.h"
39 39
40 using content::WebContents; 40 using content::WebContents;
41 using extensions::Extension; 41 using extensions::Extension;
42 using extensions::URLOverrides; 42 using extensions::URLOverrides;
43 43
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 // Fetch resources for all supported scale factors for which there are 412 // Fetch resources for all supported scale factors for which there are
413 // resources. Load image reps for all supported scale factors (in addition to 413 // resources. Load image reps for all supported scale factors (in addition to
414 // 1x) immediately instead of in an as needed fashion to be consistent with 414 // 1x) immediately instead of in an as needed fashion to be consistent with
415 // how favicons are requested for chrome:// and page URLs. 415 // how favicons are requested for chrome:// and page URLs.
416 const std::vector<ui::ScaleFactor>& scale_factors = 416 const std::vector<ui::ScaleFactor>& scale_factors =
417 FaviconUtil::GetFaviconScaleFactors(); 417 FaviconUtil::GetFaviconScaleFactors();
418 std::vector<extensions::ImageLoader::ImageRepresentation> info_list; 418 std::vector<extensions::ImageLoader::ImageRepresentation> info_list;
419 for (size_t i = 0; i < scale_factors.size(); ++i) { 419 for (size_t i = 0; i < scale_factors.size(); ++i) {
420 float scale = ui::GetScaleFactorScale(scale_factors[i]); 420 float scale = ui::GetScaleFactorScale(scale_factors[i]);
421 int pixel_size = static_cast<int>(gfx::kFaviconSize * scale); 421 int pixel_size = static_cast<int>(gfx::kFaviconSize * scale);
422 ExtensionResource icon_resource = 422 extensions::ExtensionResource icon_resource =
423 extensions::IconsInfo::GetIconResource(extension, 423 extensions::IconsInfo::GetIconResource(extension,
424 pixel_size, 424 pixel_size,
425 ExtensionIconSet::MATCH_BIGGER); 425 ExtensionIconSet::MATCH_BIGGER);
426 426
427 info_list.push_back( 427 info_list.push_back(
428 extensions::ImageLoader::ImageRepresentation( 428 extensions::ImageLoader::ImageRepresentation(
429 icon_resource, 429 icon_resource,
430 extensions::ImageLoader::ImageRepresentation::ALWAYS_RESIZE, 430 extensions::ImageLoader::ImageRepresentation::ALWAYS_RESIZE,
431 gfx::Size(pixel_size, pixel_size), 431 gfx::Size(pixel_size, pixel_size),
432 scale_factors[i])); 432 scale_factors[i]));
433 } 433 }
434 434
435 // LoadImagesAsync actually can run callback synchronously. We want to force 435 // LoadImagesAsync actually can run callback synchronously. We want to force
436 // async. 436 // async.
437 extensions::ImageLoader::Get(profile)->LoadImagesAsync( 437 extensions::ImageLoader::Get(profile)->LoadImagesAsync(
438 extension, info_list, base::Bind(&RunFaviconCallbackAsync, callback)); 438 extension, info_list, base::Bind(&RunFaviconCallbackAsync, callback));
439 } 439 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_uninstall_dialog.cc ('k') | chrome/browser/extensions/file_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698