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

Side by Side Diff: app/resource_bundle_mac.mm

Issue 344038: Merge themes/default.pak into chrome.pak for Mac and Linux builds. (Closed)
Patch Set: final Created 11 years, 1 month 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "app/resource_bundle.h" 5 #include "app/resource_bundle.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 8
9 #include "app/gfx/font.h" 9 #include "app/gfx/font.h"
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
11 #include "base/base_paths.h" 11 #include "base/base_paths.h"
12 #include "base/data_pack.h" 12 #include "base/data_pack.h"
13 #include "base/file_path.h" 13 #include "base/file_path.h"
14 #include "base/file_util.h" 14 #include "base/file_util.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/mac_util.h" 16 #include "base/mac_util.h"
17 #include "base/path_service.h" 17 #include "base/path_service.h"
18 #include "base/string_piece.h" 18 #include "base/string_piece.h"
19 #include "base/string_util.h" 19 #include "base/string_util.h"
20 #include "skia/ext/skia_utils_mac.h" 20 #include "skia/ext/skia_utils_mac.h"
21 21
22 ResourceBundle::~ResourceBundle() { 22 ResourceBundle::~ResourceBundle() {
23 FreeImages(); 23 FreeImages();
24 24
25 delete locale_resources_data_; 25 delete locale_resources_data_;
26 locale_resources_data_ = NULL; 26 locale_resources_data_ = NULL;
27 delete theme_data_;
28 theme_data_ = NULL;
29 delete resources_data_; 27 delete resources_data_;
30 resources_data_ = NULL; 28 resources_data_ = NULL;
29 theme_data_ = NULL;
31 } 30 }
32 31
33 namespace { 32 namespace {
34 33
35 base::DataPack *LoadResourceDataPack(NSString *name) { 34 base::DataPack *LoadResourceDataPack(NSString *name) {
36 base::DataPack *resource_pack = NULL; 35 base::DataPack *resource_pack = NULL;
37 36
38 NSString *resource_path = [mac_util::MainAppBundle() pathForResource:name 37 NSString *resource_path = [mac_util::MainAppBundle() pathForResource:name
39 ofType:@"pak"]; 38 ofType:@"pak"];
40 if (resource_path) { 39 if (resource_path) {
(...skipping 18 matching lines...) Expand all
59 DCHECK(resources_data_ == NULL) << "resource data already loaded!"; 58 DCHECK(resources_data_ == NULL) << "resource data already loaded!";
60 resources_data_ = LoadResourceDataPack(@"chrome"); 59 resources_data_ = LoadResourceDataPack(@"chrome");
61 DCHECK(resources_data_) << "failed to load chrome.pak"; 60 DCHECK(resources_data_) << "failed to load chrome.pak";
62 61
63 DCHECK(locale_resources_data_ == NULL) << "locale data already loaded!"; 62 DCHECK(locale_resources_data_ == NULL) << "locale data already loaded!";
64 locale_resources_data_ = LoadResourceDataPack(@"locale"); 63 locale_resources_data_ = LoadResourceDataPack(@"locale");
65 DCHECK(locale_resources_data_) << "failed to load locale.pak"; 64 DCHECK(locale_resources_data_) << "failed to load locale.pak";
66 } 65 }
67 66
68 void ResourceBundle::LoadThemeResources() { 67 void ResourceBundle::LoadThemeResources() {
69 DCHECK(theme_data_ == NULL) << "theme data already loaded!"; 68 // The data has been merged with chrome.pak so just set the pointer to be
70 theme_data_ = LoadResourceDataPack(@"theme"); 69 // the same file.
71 DCHECK(theme_data_) << "failed to load theme.pak"; 70 DCHECK(resources_data_);
71 theme_data_ = resources_data_;
72 } 72 }
73 73
74 // static 74 // static
75 RefCountedStaticMemory* ResourceBundle::LoadResourceBytes( 75 RefCountedStaticMemory* ResourceBundle::LoadResourceBytes(
76 DataHandle module, int resource_id) { 76 DataHandle module, int resource_id) {
77 DCHECK(module); 77 DCHECK(module);
78 return module->GetStaticMemory(resource_id); 78 return module->GetStaticMemory(resource_id);
79 } 79 }
80 80
81 base::StringPiece ResourceBundle::GetRawDataResource(int resource_id) { 81 base::StringPiece ResourceBundle::GetRawDataResource(int resource_id) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 NSImage* ResourceBundle::GetNSImageNamed(int resource_id) { 117 NSImage* ResourceBundle::GetNSImageNamed(int resource_id) {
118 // Currently this doesn't make a cache holding these as NSImages because 118 // Currently this doesn't make a cache holding these as NSImages because
119 // GetBitmapNamed has a cache, and we don't want to double cache. 119 // GetBitmapNamed has a cache, and we don't want to double cache.
120 SkBitmap* bitmap = GetBitmapNamed(resource_id); 120 SkBitmap* bitmap = GetBitmapNamed(resource_id);
121 if (!bitmap) 121 if (!bitmap)
122 return nil; 122 return nil;
123 123
124 NSImage* nsimage = gfx::SkBitmapToNSImage(*bitmap); 124 NSImage* nsimage = gfx::SkBitmapToNSImage(*bitmap);
125 return nsimage; 125 return nsimage;
126 } 126 }
OLDNEW
« no previous file with comments | « app/resource_bundle_linux.cc ('k') | chrome/chrome.gyp » ('j') | chrome/chrome.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698