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

Side by Side Diff: chrome/browser/themes/browser_theme_pack.cc

Issue 19471005: Add custom default theme support and create a managed user default theme. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. Created 7 years, 5 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/themes/browser_theme_pack.h" 5 #include "chrome/browser/themes/browser_theme_pack.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/memory/ref_counted_memory.h" 9 #include "base/memory/ref_counted_memory.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 11 matching lines...) Expand all
22 #include "grit/theme_resources.h" 22 #include "grit/theme_resources.h"
23 #include "grit/ui_resources.h" 23 #include "grit/ui_resources.h"
24 #include "net/base/file_stream.h" 24 #include "net/base/file_stream.h"
25 #include "net/base/net_errors.h" 25 #include "net/base/net_errors.h"
26 #include "third_party/skia/include/core/SkCanvas.h" 26 #include "third_party/skia/include/core/SkCanvas.h"
27 #include "ui/base/resource/data_pack.h" 27 #include "ui/base/resource/data_pack.h"
28 #include "ui/base/resource/resource_bundle.h" 28 #include "ui/base/resource/resource_bundle.h"
29 #include "ui/gfx/canvas.h" 29 #include "ui/gfx/canvas.h"
30 #include "ui/gfx/codec/png_codec.h" 30 #include "ui/gfx/codec/png_codec.h"
31 #include "ui/gfx/image/canvas_image_source.h" 31 #include "ui/gfx/image/canvas_image_source.h"
32 #include "ui/gfx/image/image.h"
32 #include "ui/gfx/image/image_skia.h" 33 #include "ui/gfx/image/image_skia.h"
33 #include "ui/gfx/image/image_skia_operations.h" 34 #include "ui/gfx/image/image_skia_operations.h"
34 #include "ui/gfx/screen.h" 35 #include "ui/gfx/screen.h"
35 #include "ui/gfx/size_conversions.h" 36 #include "ui/gfx/size_conversions.h"
36 #include "ui/gfx/skia_util.h" 37 #include "ui/gfx/skia_util.h"
37 38
38 using content::BrowserThread; 39 using content::BrowserThread;
39 using extensions::Extension; 40 using extensions::Extension;
40 41
41 namespace { 42 namespace {
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 if (it != image_memory_.end()) { 885 if (it != image_memory_.end()) {
885 memory = it->second.get(); 886 memory = it->second.get();
886 } 887 }
887 } 888 }
888 } 889 }
889 890
890 return memory; 891 return memory;
891 } 892 }
892 893
893 // static 894 // static
894 void BrowserThemePack::GetThemeableImageIDRs(std::set<int>* result) { 895 void BrowserThemePack::GetThemeableImageIDRs(std::set<int>* result) {
pkotwicz 2013/07/19 18:33:20 Reorder this method to match reordering in the hea
Adrian Kuegel 2013/07/22 12:58:08 Done.
895 if (!result) 896 if (!result)
896 return; 897 return;
897 898
898 result->clear(); 899 result->clear();
899 for (size_t i = 0; i < kPersistingImagesLength; ++i) 900 for (size_t i = 0; i < kPersistingImagesLength; ++i)
900 result->insert(kPersistingImages[i].idr_id); 901 result->insert(kPersistingImages[i].idr_id);
901 902
902 #if defined(OS_WIN) && defined(USE_AURA) 903 #if defined(OS_WIN) && defined(USE_AURA)
903 for (size_t i = 0; i < kPersistingImagesWinDesktopAuraLength; ++i) 904 for (size_t i = 0; i < kPersistingImagesWinDesktopAuraLength; ++i)
904 result->insert(kPersistingImagesWinDesktopAura[i].idr_id); 905 result->insert(kPersistingImagesWinDesktopAura[i].idr_id);
(...skipping 10 matching lines...) Expand all
915 if (*img == prs_id) 916 if (*img == prs_id)
916 return true; 917 return true;
917 } 918 }
918 919
919 return false; 920 return false;
920 } 921 }
921 922
922 // private: 923 // private:
923 924
924 BrowserThemePack::BrowserThemePack() 925 BrowserThemePack::BrowserThemePack()
925 : header_(NULL), 926 : CustomThemeSupplier(EXTENSION),
927 header_(NULL),
926 tints_(NULL), 928 tints_(NULL),
927 colors_(NULL), 929 colors_(NULL),
928 display_properties_(NULL), 930 display_properties_(NULL),
929 source_images_(NULL) { 931 source_images_(NULL) {
930 scale_factors_ = ui::GetSupportedScaleFactors(); 932 scale_factors_ = ui::GetSupportedScaleFactors();
931 } 933 }
932 934
933 void BrowserThemePack::BuildHeader(const Extension* extension) { 935 void BrowserThemePack::BuildHeader(const Extension* extension) {
934 header_ = new BrowserThemePackHeader; 936 header_ = new BrowserThemePackHeader;
935 header_->version = kThemePackVersion; 937 header_->version = kThemePackVersion;
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1604 false, 1606 false,
1605 &bitmap_data)) { 1607 &bitmap_data)) {
1606 NOTREACHED() << "Unable to encode theme image for prs_id=" 1608 NOTREACHED() << "Unable to encode theme image for prs_id="
1607 << prs_id << " for scale_factor=" << scale_factors_[i]; 1609 << prs_id << " for scale_factor=" << scale_factors_[i];
1608 break; 1610 break;
1609 } 1611 }
1610 image_memory_[scaled_raw_id] = 1612 image_memory_[scaled_raw_id] =
1611 base::RefCountedBytes::TakeVector(&bitmap_data); 1613 base::RefCountedBytes::TakeVector(&bitmap_data);
1612 } 1614 }
1613 } 1615 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698