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

Side by Side Diff: chrome/common/resource_bundle_linux.cc

Issue 40246: Generate data packs for all languages and allow us to load (Closed)
Patch Set: comment Created 11 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
« no previous file with comments | « chrome/app/resources/locale_settings.grd ('k') | webkit/glue/webkit_strings.grd » ('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-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 "chrome/common/resource_bundle.h" 5 #include "chrome/common/resource_bundle.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/data_pack.h" 10 #include "base/data_pack.h"
(...skipping 21 matching lines...) Expand all
32 void ResourceBundle::LoadResources(const std::wstring& pref_locale) { 32 void ResourceBundle::LoadResources(const std::wstring& pref_locale) {
33 FilePath resources_data_path; 33 FilePath resources_data_path;
34 PathService::Get(base::DIR_EXE, &resources_data_path); 34 PathService::Get(base::DIR_EXE, &resources_data_path);
35 resources_data_path = resources_data_path.Append( 35 resources_data_path = resources_data_path.Append(
36 FILE_PATH_LITERAL("chrome.pak")); 36 FILE_PATH_LITERAL("chrome.pak"));
37 DCHECK(resources_data_ == NULL) << "resource data already loaded!"; 37 DCHECK(resources_data_ == NULL) << "resource data already loaded!";
38 resources_data_ = new base::DataPack; 38 resources_data_ = new base::DataPack;
39 bool success = resources_data_->Load(resources_data_path); 39 bool success = resources_data_->Load(resources_data_path);
40 DCHECK(success) << "failed to load chrome.pak"; 40 DCHECK(success) << "failed to load chrome.pak";
41 41
42 FilePath locale_path;
43 PathService::Get(chrome::DIR_LOCALES, &locale_path);
44 // TODO(tc): Handle other locales properly.
45 // http://code.google.com/p/chromium/issues/detail?id=8125
46 locale_path = locale_path.Append(FILE_PATH_LITERAL("en-US.pak"));
47 DCHECK(locale_resources_data_ == NULL) << "locale data already loaded!"; 42 DCHECK(locale_resources_data_ == NULL) << "locale data already loaded!";
43 const FilePath& locale_path = GetLocaleFilePath(pref_locale);
44 if (locale_path.value().empty()) {
45 // It's possible that there are no locale dlls found, in which case we just
46 // return.
47 NOTREACHED();
48 return;
Evan Martin 2009/03/06 20:39:53 Shouldn't we die horribly here?
49 }
50
48 locale_resources_data_ = new base::DataPack; 51 locale_resources_data_ = new base::DataPack;
49 success = locale_resources_data_->Load(locale_path); 52 success = locale_resources_data_->Load(locale_path);
50 DCHECK(success) << "failed to load locale pak file"; 53 DCHECK(success) << "failed to load locale pak file";
51 } 54 }
52 55
53 FilePath ResourceBundle::GetLocaleFilePath(const std::wstring& pref_locale) { 56 FilePath ResourceBundle::GetLocaleFilePath(const std::wstring& pref_locale) {
54 FilePath locale_path; 57 FilePath locale_path;
55 PathService::Get(chrome::DIR_LOCALES, &locale_path); 58 PathService::Get(chrome::DIR_LOCALES, &locale_path);
56 59
57 const std::wstring app_locale = l10n_util::GetApplicationLocale(pref_locale); 60 const std::wstring app_locale = l10n_util::GetApplicationLocale(pref_locale);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 GdkPixbuf* pixbuf = gdk_pixbuf_loader_get_pixbuf(loader); 136 GdkPixbuf* pixbuf = gdk_pixbuf_loader_get_pixbuf(loader);
134 DCHECK(pixbuf) << "failed to load " << resource_id << " " << data.size(); 137 DCHECK(pixbuf) << "failed to load " << resource_id << " " << data.size();
135 138
136 // The pixbuf is owned by the loader, so add a ref so when we delete the 139 // The pixbuf is owned by the loader, so add a ref so when we delete the
137 // loader, the pixbuf still exists. 140 // loader, the pixbuf still exists.
138 g_object_ref(pixbuf); 141 g_object_ref(pixbuf);
139 g_object_unref(loader); 142 g_object_unref(loader);
140 143
141 return pixbuf; 144 return pixbuf;
142 } 145 }
OLDNEW
« no previous file with comments | « chrome/app/resources/locale_settings.grd ('k') | webkit/glue/webkit_strings.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698