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

Side by Side Diff: ui/base/resource/resource_bundle_linux.cc

Issue 6263008: Move ResourceBundle, DataPack to ui/base (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 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
« no previous file with comments | « ui/base/resource/resource_bundle_dummy.cc ('k') | ui/base/resource/resource_bundle_mac.mm » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ui/base/resource/resource_bundle.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "app/app_paths.h"
10 #include "base/base_paths.h" 9 #include "base/base_paths.h"
11 #include "base/file_path.h" 10 #include "base/file_path.h"
12 #include "base/file_util.h" 11 #include "base/file_util.h"
13 #include "base/i18n/rtl.h" 12 #include "base/i18n/rtl.h"
14 #include "base/lock.h" 13 #include "base/lock.h"
15 #include "base/logging.h" 14 #include "base/logging.h"
16 #include "base/path_service.h" 15 #include "base/path_service.h"
17 #include "base/string_piece.h" 16 #include "base/string_piece.h"
18 #include "base/string_util.h" 17 #include "base/string_util.h"
19 #include "gfx/font.h" 18 #include "gfx/font.h"
20 #include "gfx/gtk_util.h" 19 #include "gfx/gtk_util.h"
21 #include "third_party/skia/include/core/SkBitmap.h" 20 #include "third_party/skia/include/core/SkBitmap.h"
21 #include "ui/base/ui_base_paths.h"
22
23 namespace ui {
22 24
23 namespace { 25 namespace {
24 26
25 // Convert the raw image data into a GdkPixbuf. The GdkPixbuf that is returned 27 // Convert the raw image data into a GdkPixbuf. The GdkPixbuf that is returned
26 // has a ref count of 1 so the caller must call g_object_unref to free the 28 // has a ref count of 1 so the caller must call g_object_unref to free the
27 // memory. 29 // memory.
28 GdkPixbuf* LoadPixbuf(RefCountedStaticMemory* data, bool rtl_enabled) { 30 GdkPixbuf* LoadPixbuf(RefCountedStaticMemory* data, bool rtl_enabled) {
29 ScopedGObject<GdkPixbufLoader>::Type loader(gdk_pixbuf_loader_new()); 31 ScopedGObject<GdkPixbufLoader>::Type loader(gdk_pixbuf_loader_new());
30 bool ok = data && gdk_pixbuf_loader_write(loader.get(), 32 bool ok = data && gdk_pixbuf_loader_write(loader.get(),
31 reinterpret_cast<const guint8*>(data->front()), data->size(), NULL); 33 reinterpret_cast<const guint8*>(data->front()), data->size(), NULL);
(...skipping 27 matching lines...) Expand all
59 for (GdkPixbufMap::iterator i = gdk_pixbufs_.begin(); 61 for (GdkPixbufMap::iterator i = gdk_pixbufs_.begin();
60 i != gdk_pixbufs_.end(); i++) { 62 i != gdk_pixbufs_.end(); i++) {
61 g_object_unref(i->second); 63 g_object_unref(i->second);
62 } 64 }
63 gdk_pixbufs_.clear(); 65 gdk_pixbufs_.clear();
64 } 66 }
65 67
66 // static 68 // static
67 FilePath ResourceBundle::GetResourcesFilePath() { 69 FilePath ResourceBundle::GetResourcesFilePath() {
68 FilePath resources_file_path; 70 FilePath resources_file_path;
69 PathService::Get(app::FILE_RESOURCES_PAK, &resources_file_path); 71 PathService::Get(ui::FILE_RESOURCES_PAK, &resources_file_path);
70 return resources_file_path; 72 return resources_file_path;
71 } 73 }
72 74
73 // static 75 // static
74 FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale) { 76 FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale) {
75 FilePath locale_file_path; 77 FilePath locale_file_path;
76 PathService::Get(app::DIR_LOCALES, &locale_file_path); 78 PathService::Get(ui::DIR_LOCALES, &locale_file_path);
77 if (locale_file_path.empty()) 79 if (locale_file_path.empty())
78 return locale_file_path; 80 return locale_file_path;
79 if (app_locale.empty()) 81 if (app_locale.empty())
80 return FilePath(); 82 return FilePath();
81 locale_file_path = locale_file_path.AppendASCII(app_locale + ".pak"); 83 locale_file_path = locale_file_path.AppendASCII(app_locale + ".pak");
82 if (!file_util::PathExists(locale_file_path)) 84 if (!file_util::PathExists(locale_file_path))
83 return FilePath(); 85 return FilePath();
84 return locale_file_path; 86 return locale_file_path;
85 } 87 }
86 88
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 137 }
136 } 138 }
137 139
138 GdkPixbuf* ResourceBundle::GetPixbufNamed(int resource_id) { 140 GdkPixbuf* ResourceBundle::GetPixbufNamed(int resource_id) {
139 return GetPixbufImpl(resource_id, false); 141 return GetPixbufImpl(resource_id, false);
140 } 142 }
141 143
142 GdkPixbuf* ResourceBundle::GetRTLEnabledPixbufNamed(int resource_id) { 144 GdkPixbuf* ResourceBundle::GetRTLEnabledPixbufNamed(int resource_id) {
143 return GetPixbufImpl(resource_id, true); 145 return GetPixbufImpl(resource_id, true);
144 } 146 }
147
148 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/resource/resource_bundle_dummy.cc ('k') | ui/base/resource/resource_bundle_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698