From 9929da90886e2df0c91810766cf09b4b110218c6 Mon Sep 17 00:00:00 2001 From: "ben@chromium.org" Date: Tue, 5 May 2009 02:05:11 +0000 Subject: Adds toplevel app/ directory and moves ResourceBundle into it. No changes to resource bundle yet, just the move to keep this CL as compact as possible. Adds new vcproj and gyp file for app dir. http://crbug.com/11387 Review URL: http://codereview.chromium.org/100354 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15264 0039d316-1c4b-4281-b951-d872f2087c98 --- app/DEPS | 8 + app/app.vcproj | 139 ++++++++++++++ app/app.vsprops | 8 + app/resource_bundle.cc | 205 ++++++++++++++++++++ app/resource_bundle.h | 203 ++++++++++++++++++++ app/resource_bundle_linux.cc | 209 +++++++++++++++++++++ app/resource_bundle_mac.mm | 120 ++++++++++++ app/resource_bundle_win.cc | 157 ++++++++++++++++ chrome/DEPS | 1 + chrome/app/chrome_dll_main.cc | 2 +- chrome/browser/alternate_nav_url_fetcher.cc | 2 +- .../autocomplete/autocomplete_popup_view_gtk.cc | 10 +- .../autocomplete/autocomplete_popup_view_win.cc | 2 +- .../bookmarks/bookmark_folder_tree_model.cc | 2 +- .../browser/bookmarks/bookmark_menu_controller.cc | 2 +- chrome/browser/bookmarks/bookmark_table_model.cc | 2 +- chrome/browser/browser_about_handler.cc | 2 +- chrome/browser/browser_init.cc | 6 +- chrome/browser/browser_main.cc | 2 +- chrome/browser/browser_shutdown.cc | 2 +- chrome/browser/debugger/debugger_shell.cc | 2 +- chrome/browser/debugger/debugger_view.cc | 3 +- chrome/browser/dom_ui/debugger_ui.cc | 2 +- chrome/browser/dom_ui/dom_ui_favicon_source.cc | 3 +- chrome/browser/dom_ui/dom_ui_thumbnail_source.cc | 3 +- chrome/browser/dom_ui/fileicon_source.h | 2 +- chrome/browser/dom_ui/history_ui.cc | 2 +- chrome/browser/dom_ui/new_tab_ui.cc | 2 +- chrome/browser/download/download_util.cc | 2 +- chrome/browser/drag_utils.cc | 2 +- chrome/browser/extensions/extension.cc | 2 +- chrome/browser/extensions/extension_host.cc | 2 +- chrome/browser/extensions/extensions_ui.cc | 2 +- chrome/browser/first_run.cc | 2 +- chrome/browser/gtk/about_chrome_dialog.cc | 2 +- chrome/browser/gtk/bookmark_bar_gtk.cc | 2 +- chrome/browser/gtk/browser_toolbar_gtk.cc | 2 +- chrome/browser/gtk/browser_window_gtk.cc | 2 +- chrome/browser/gtk/custom_button.cc | 2 +- chrome/browser/gtk/download_shelf_gtk.cc | 2 +- chrome/browser/gtk/nine_box.cc | 2 +- chrome/browser/gtk/tabs/tab_gtk.cc | 2 +- chrome/browser/gtk/tabs/tab_renderer_gtk.cc | 2 +- chrome/browser/gtk/tabs/tab_strip_gtk.cc | 2 +- chrome/browser/gtk/toolbar_star_toggle_gtk.cc | 2 +- .../browser/password_manager/password_manager.cc | 2 +- chrome/browser/plugin_installer.cc | 2 +- chrome/browser/renderer_host/render_view_host.cc | 2 +- .../renderer_host/render_widget_host_view_win.cc | 2 +- .../safe_browsing/safe_browsing_blocking_page.cc | 2 +- chrome/browser/ssl/ssl_blocking_page.cc | 2 +- chrome/browser/ssl/ssl_manager.cc | 2 +- chrome/browser/ssl/ssl_policy.cc | 2 +- .../browser/tab_contents/navigation_controller.cc | 2 +- chrome/browser/tab_contents/navigation_entry.cc | 2 +- chrome/browser/tab_contents/tab_contents.cc | 2 +- chrome/browser/task_manager.cc | 2 +- chrome/browser/task_manager_resource_providers.cc | 2 +- chrome/browser/views/about_chrome_view.cc | 2 +- .../autocomplete_popup_contents_view.cc | 2 +- chrome/browser/views/blocked_popup_container.cc | 2 +- chrome/browser/views/bookmark_bar_view.cc | 2 +- chrome/browser/views/bookmark_bubble_view.cc | 2 +- chrome/browser/views/bookmark_menu_button.cc | 2 +- chrome/browser/views/bookmark_table_view.cc | 2 +- chrome/browser/views/constrained_window_impl.cc | 2 +- chrome/browser/views/download_item_view.cc | 2 +- chrome/browser/views/download_shelf_view.cc | 2 +- chrome/browser/views/download_started_animation.cc | 2 +- chrome/browser/views/edit_keyword_controller.cc | 2 +- chrome/browser/views/find_bar_view.cc | 2 +- chrome/browser/views/first_run_bubble.cc | 2 +- chrome/browser/views/first_run_customize_view.cc | 2 +- chrome/browser/views/first_run_view.cc | 2 +- chrome/browser/views/first_run_view_base.cc | 2 +- chrome/browser/views/frame/browser_frame.cc | 2 +- chrome/browser/views/frame/browser_view.cc | 2 +- .../views/frame/glass_browser_frame_view.cc | 2 +- .../views/frame/opaque_browser_frame_view.cc | 2 +- chrome/browser/views/fullscreen_exit_bubble.cc | 2 +- chrome/browser/views/hung_renderer_view.cc | 2 +- chrome/browser/views/info_bubble.cc | 2 +- chrome/browser/views/infobars/infobars.cc | 2 +- chrome/browser/views/keyword_editor_view.cc | 10 +- chrome/browser/views/location_bar_view.cc | 2 +- .../views/options/advanced_contents_view.cc | 2 +- chrome/browser/views/options/content_page_view.cc | 2 +- chrome/browser/views/options/cookies_view.cc | 2 +- .../views/options/fonts_languages_window_view.cc | 2 +- chrome/browser/views/options/fonts_page_view.cc | 7 +- chrome/browser/views/options/general_page_view.cc | 2 +- .../browser/views/options/languages_page_view.cc | 2 +- chrome/browser/views/options/options_group_view.cc | 2 +- .../browser/views/options/options_window_view.cc | 2 +- chrome/browser/views/page_info_window.cc | 2 +- chrome/browser/views/sad_tab_view.cc | 2 +- chrome/browser/views/shelf_item_dialog.cc | 2 +- chrome/browser/views/star_toggle.cc | 2 +- chrome/browser/views/status_bubble_views.cc | 4 +- chrome/browser/views/tab_icon_view.cc | 2 +- .../browser/views/tabs/dragged_tab_controller.cc | 2 +- chrome/browser/views/tabs/tab.cc | 2 +- chrome/browser/views/tabs/tab_renderer.cc | 2 +- chrome/browser/views/tabs/tab_strip.cc | 2 +- chrome/browser/views/toolbar_star_toggle.cc | 2 +- chrome/browser/views/toolbar_view.cc | 2 +- chrome/chrome.gyp | 38 +++- chrome/chrome.sln | 26 +++ chrome/common/common.vcproj | 16 +- chrome/common/jstemplate_builder.cc | 2 +- chrome/common/l10n_util.cc | 2 +- chrome/common/resource_bundle.cc | 205 -------------------- chrome/common/resource_bundle.h | 206 -------------------- chrome/common/resource_bundle_linux.cc | 209 --------------------- chrome/common/resource_bundle_mac.mm | 120 ------------ chrome/common/resource_bundle_win.cc | 164 ---------------- chrome/common/security_filter_peer.cc | 2 +- chrome/renderer/extensions/bindings_utils.h | 2 +- .../extensions/greasemonkey_api_unittest.cc | 2 +- chrome/renderer/extensions/json_schema_unittest.cc | 2 +- .../extensions/renderer_extension_bindings.cc | 2 +- chrome/renderer/render_view.cc | 2 +- chrome/renderer/renderer_glue.cc | 2 +- chrome/renderer/renderer_main.cc | 2 +- chrome/renderer/user_script_slave.cc | 2 +- chrome/renderer/webplugin_delegate_proxy.cc | 2 +- chrome/test/unit/chrome_test_suite.h | 2 +- chrome/views/controls/button/menu_button.cc | 2 +- chrome/views/controls/button/text_button.cc | 2 +- chrome/views/controls/combo_box.cc | 2 +- chrome/views/controls/label.cc | 2 +- chrome/views/controls/scroll_view.cc | 2 +- chrome/views/controls/tabbed_pane.cc | 2 +- chrome/views/controls/table/table_view.cc | 2 +- chrome/views/controls/throbber.cc | 2 +- chrome/views/controls/tree/tree_view.cc | 2 +- chrome/views/focus/focus_manager_unittest.cc | 2 +- chrome/views/painter.cc | 2 +- chrome/views/window/custom_frame_view.cc | 2 +- chrome/views/window/dialog_client_view.cc | 2 +- chrome/views/window/window_win.cc | 2 +- 141 files changed, 1249 insertions(+), 1063 deletions(-) create mode 100644 app/DEPS create mode 100644 app/app.vcproj create mode 100644 app/app.vsprops create mode 100644 app/resource_bundle.cc create mode 100644 app/resource_bundle.h create mode 100644 app/resource_bundle_linux.cc create mode 100644 app/resource_bundle_mac.mm create mode 100644 app/resource_bundle_win.cc delete mode 100644 chrome/common/resource_bundle.cc delete mode 100644 chrome/common/resource_bundle.h delete mode 100644 chrome/common/resource_bundle_linux.cc delete mode 100644 chrome/common/resource_bundle_mac.mm delete mode 100644 chrome/common/resource_bundle_win.cc diff --git a/app/DEPS b/app/DEPS new file mode 100644 index 0000000..9ff54fa --- /dev/null +++ b/app/DEPS @@ -0,0 +1,8 @@ +include_rules = [ + "+net", + # TODO(beng): Sever this link once we have extracted all deps from + # chrome/common. + "+chrome/common", + # TODO(beng): Sever this link after glen fixes it. + "+chrome/browser/extensions/extension.h", +] diff --git a/app/app.vcproj b/app/app.vcproj new file mode 100644 index 0000000..22c1e1f --- /dev/null +++ b/app/app.vcproj @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/app.vsprops b/app/app.vsprops new file mode 100644 index 0000000..fb267c1 --- /dev/null +++ b/app/app.vsprops @@ -0,0 +1,8 @@ + + + diff --git a/app/resource_bundle.cc b/app/resource_bundle.cc new file mode 100644 index 0000000..5b3c034 --- /dev/null +++ b/app/resource_bundle.cc @@ -0,0 +1,205 @@ +// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "app/resource_bundle.h" + +#include "base/gfx/png_decoder.h" +#include "base/logging.h" +#include "base/string_piece.h" +#include "net/base/file_stream.h" +#include "net/base/net_errors.h" +#include "chrome/common/gfx/chrome_font.h" +#include "SkBitmap.h" + +ResourceBundle* ResourceBundle::g_shared_instance_ = NULL; + +/* static */ +void ResourceBundle::InitSharedInstance(const std::wstring& pref_locale) { + DCHECK(g_shared_instance_ == NULL) << "ResourceBundle initialized twice"; + g_shared_instance_ = new ResourceBundle(); + + g_shared_instance_->LoadResources(pref_locale); +} + +/* static */ +void ResourceBundle::CleanupSharedInstance() { + if (g_shared_instance_) { + delete g_shared_instance_; + g_shared_instance_ = NULL; + } +} + +/* static */ +ResourceBundle& ResourceBundle::GetSharedInstance() { + // Must call InitSharedInstance before this function. + CHECK(g_shared_instance_ != NULL); + return *g_shared_instance_; +} + +ResourceBundle::ResourceBundle() + : resources_data_(NULL), + locale_resources_data_(NULL), + theme_data_(NULL) { +} + +void ResourceBundle::FreeImages() { + for (SkImageMap::iterator i = skia_images_.begin(); + i != skia_images_.end(); i++) { + delete i->second; + } + skia_images_.clear(); +} + +void ResourceBundle::SetThemeExtension(const Extension& e) { + theme_extension_.reset(new Extension(e)); +} + +/* static */ +SkBitmap* ResourceBundle::LoadBitmap(DataHandle data_handle, int resource_id) { + std::vector raw_data, png_data; + bool success = false; + // First check to see if we have a registered theme extension and whether + // it can handle this resource. + // TODO(erikkay): It would be nice to use something less brittle than + // resource_id here. + if (g_shared_instance_->theme_extension_.get()) { + FilePath path = + g_shared_instance_->theme_extension_->GetThemeResourcePath(resource_id); + if (!path.empty()) { + net::FileStream file; + int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ; + if (file.Open(path, flags) == net::OK) { + int64 avail = file.Available(); + if (avail > 0 && avail < INT_MAX) { + size_t size = static_cast(avail); + raw_data.resize(size); + char* data = reinterpret_cast(&(raw_data.front())); + if (file.ReadUntilComplete(data, size) == avail) { + success= true; + } else { + raw_data.resize(0); + } + } + } + } + } + if (!success) + success = LoadResourceBytes(data_handle, resource_id, &raw_data); + if (!success) + return NULL; + + // Decode the PNG. + int image_width; + int image_height; + if (!PNGDecoder::Decode(&raw_data.front(), raw_data.size(), + PNGDecoder::FORMAT_BGRA, + &png_data, &image_width, &image_height)) { + NOTREACHED() << "Unable to decode image resource " << resource_id; + return NULL; + } + + return PNGDecoder::CreateSkBitmapFromBGRAFormat(png_data, + image_width, + image_height); +} + +std::string ResourceBundle::GetDataResource(int resource_id) { + return GetRawDataResource(resource_id).as_string(); +} + +bool ResourceBundle::LoadImageResourceBytes(int resource_id, + std::vector* bytes) { + return LoadResourceBytes(theme_data_, resource_id, bytes); +} + +bool ResourceBundle::LoadDataResourceBytes(int resource_id, + std::vector* bytes) { + return LoadResourceBytes(resources_data_, resource_id, bytes); +} + +SkBitmap* ResourceBundle::GetBitmapNamed(int resource_id) { + // Check to see if we already have the Skia image in the cache. + { + AutoLock lock_scope(lock_); + SkImageMap::const_iterator found = skia_images_.find(resource_id); + if (found != skia_images_.end()) + return found->second; + } + + scoped_ptr bitmap; + + if (theme_data_) + bitmap.reset(LoadBitmap(theme_data_, resource_id)); + + // If we did not find the bitmap in the theme DLL, try the current one. + if (!bitmap.get()) + bitmap.reset(LoadBitmap(resources_data_, resource_id)); + + // We loaded successfully. Cache the Skia version of the bitmap. + if (bitmap.get()) { + AutoLock lock_scope(lock_); + + // Another thread raced us, and has already cached the skia image. + if (skia_images_.count(resource_id)) + return skia_images_[resource_id]; + + skia_images_[resource_id] = bitmap.get(); + return bitmap.release(); + } + + // We failed to retrieve the bitmap, show a debugging red square. + { + LOG(WARNING) << "Unable to load bitmap with id " << resource_id; + NOTREACHED(); // Want to assert in debug mode. + + AutoLock lock_scope(lock_); // Guard empty_bitmap initialization. + + static SkBitmap* empty_bitmap = NULL; + if (!empty_bitmap) { + // The placeholder bitmap is bright red so people notice the problem. + // This bitmap will be leaked, but this code should never be hit. + empty_bitmap = new SkBitmap(); + empty_bitmap->setConfig(SkBitmap::kARGB_8888_Config, 32, 32); + empty_bitmap->allocPixels(); + empty_bitmap->eraseARGB(255, 255, 0, 0); + } + return empty_bitmap; + } +} + +void ResourceBundle::LoadFontsIfNecessary() { + AutoLock lock_scope(lock_); + if (!base_font_.get()) { + base_font_.reset(new ChromeFont()); + + small_font_.reset(new ChromeFont()); + *small_font_ = base_font_->DeriveFont(-2); + + medium_font_.reset(new ChromeFont()); + *medium_font_ = base_font_->DeriveFont(3); + + medium_bold_font_.reset(new ChromeFont()); + *medium_bold_font_ = + base_font_->DeriveFont(3, base_font_->style() | ChromeFont::BOLD); + + large_font_.reset(new ChromeFont()); + *large_font_ = base_font_->DeriveFont(8); + } +} + +ChromeFont ResourceBundle::GetFont(FontStyle style) { + LoadFontsIfNecessary(); + switch(style) { + case SmallFont: + return *small_font_; + case MediumFont: + return *medium_font_; + case MediumBoldFont: + return *medium_bold_font_; + case LargeFont: + return *large_font_; + default: + return *base_font_; + } +} diff --git a/app/resource_bundle.h b/app/resource_bundle.h new file mode 100644 index 0000000..e3c572c --- /dev/null +++ b/app/resource_bundle.h @@ -0,0 +1,203 @@ +// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_COMMON_RESOURCE_BUNDLE_H__ +#define CHROME_COMMON_RESOURCE_BUNDLE_H__ + +#include "build/build_config.h" + +#if defined(OS_WIN) +#include +#endif + +#include +#include + +#include "base/basictypes.h" +#include "base/file_path.h" +#include "base/lock.h" +#include "base/scoped_ptr.h" +#include "chrome/browser/extensions/extension.h" + +#if defined(OS_LINUX) || defined(OS_MACOSX) +namespace base { + class DataPack; +}; +#endif +#if defined(OS_LINUX) +typedef struct _GdkPixbuf GdkPixbuf; +#endif +class ChromeFont; +class Extension; +class SkBitmap; +class StringPiece; + +// ResourceBundle is a central facility to load images and other resources, +// such as theme graphics. +// Every resource is loaded only once. +class ResourceBundle { + public: + // An enumeration of the various font styles used throughout Chrome. + // The following holds true for the font sizes: + // Small <= Base <= Medium <= MediumBold <= Large. + enum FontStyle { + SmallFont, + BaseFont, + MediumFont, + // NOTE: depending upon the locale, this may *not* result in a bold font. + MediumBoldFont, + LargeFont, + }; + + // Initialize the ResourceBundle for this process. + // NOTE: Mac ignores this and always loads up resources for the language + // defined by the Cocoa UI (ie-NSBundle does the langange work). + static void InitSharedInstance(const std::wstring& pref_locale); + + // Delete the ResourceBundle for this process if it exists. + static void CleanupSharedInstance(); + + // Return the global resource loader instance. + static ResourceBundle& GetSharedInstance(); + + // Load the data file that contains theme resources if present. + void LoadThemeResources(); + + // Gets the bitmap with the specified resource_id, first by looking into the + // theme data, than in the current module data if applicable. + // Returns a pointer to a shared instance of the SkBitmap. This shared bitmap + // is owned by the resource bundle and should not be freed. + // + // The bitmap is assumed to exist. This function will log in release, and + // assert in debug mode if it does not. On failure, this will return a + // pointer to a shared empty placeholder bitmap so it will be visible what + // is missing. + SkBitmap* GetBitmapNamed(int resource_id); + + // Loads the raw bytes of an image resource into |bytes|, + // without doing any processing or interpretation of + // the resource. Returns whether we successfully read the resource. + bool LoadImageResourceBytes(int resource_id, + std::vector* bytes); + + // Loads the raw bytes of a data resource into |bytes|, + // without doing any processing or interpretation of + // the resource. Returns whether we successfully read the resource. + bool LoadDataResourceBytes(int resource_id, + std::vector* bytes); + + // Return the contents of a file in a string given the resource id. + // This will copy the data from the resource and return it as a string. + // TODO(port): deprecate this and replace with GetRawDataResource to avoid + // needless copying. + std::string GetDataResource(int resource_id); + + // Like GetDataResource(), but avoids copying the resource. Instead, it + // returns a StringPiece which points into the actual resource in the image. + StringPiece GetRawDataResource(int resource_id); + + // Get a localized string given a message id. Returns an empty + // string if the message_id is not found. + string16 GetLocalizedString(int message_id); + + // Returns the font for the specified style. + ChromeFont GetFont(FontStyle style); + +#if defined(OS_WIN) + // Loads and returns an icon from the theme dll. + HICON LoadThemeIcon(int icon_id); + + // Loads and returns a cursor from the app module. + HCURSOR LoadCursor(int cursor_id); +#elif defined(OS_LINUX) + // Gets the GdkPixbuf with the specified resource_id, first by looking into + // the theme data, than in the current module data if applicable. Returns a + // pointer to a shared instance of the GdkPixbuf. This shared GdkPixbuf is + // owned by the resource bundle and should not be freed. + // + // The bitmap is assumed to exist. This function will log in release, and + // assert in debug mode if it does not. On failure, this will return a + // pointer to a shared empty placeholder bitmap so it will be visible what + // is missing. + GdkPixbuf* GetPixbufNamed(int resource_id); +#endif + + // Sets an Extension object that can handle theme resource requests. + void SetThemeExtension(const Extension& e); + + private: + // We define a DataHandle typedef to abstract across how data is stored + // across platforms. +#if defined(OS_WIN) + // Windows stores resources in DLLs, which are managed by HINSTANCE. + typedef HINSTANCE DataHandle; +#elif defined(OS_LINUX) || defined(OS_MACOSX) + // Linux uses base::DataPack. + typedef base::DataPack* DataHandle; +#endif + + // Ctor/dtor are private, since we're a singleton. + ResourceBundle(); + ~ResourceBundle(); + + // Free skia_images_. + void FreeImages(); + + // Try to load the main resources and the locale specific strings from an + // external data module. + void LoadResources(const std::wstring& pref_locale); + + // Initialize all the ChromeFont members if they haven't yet been initialized. + void LoadFontsIfNecessary(); + + // Returns the full pathname of the locale file to load. May return an empty + // string if no locale data files are found. + FilePath GetLocaleFilePath(const std::wstring& pref_locale); + + // Loads the raw bytes of a resource from |module| into |bytes|, + // without doing any processing or interpretation of + // the resource. Returns whether we successfully read the resource. + static bool LoadResourceBytes(DataHandle module, + int resource_id, + std::vector* bytes); + + // Creates and returns a new SkBitmap given the data file to look in and the + // resource id. It's up to the caller to free the returned bitmap when + // done. + static SkBitmap* LoadBitmap(DataHandle dll_inst, int resource_id); + + // Class level lock. Used to protect internal data structures that may be + // accessed from other threads (e.g., skia_images_). + Lock lock_; + + // Handles for data sources. + DataHandle resources_data_; + DataHandle locale_resources_data_; + DataHandle theme_data_; + + // Cached images. The ResourceBundle caches all retrieved bitmaps and keeps + // ownership of the pointers. + typedef std::map SkImageMap; + SkImageMap skia_images_; +#if defined(OS_LINUX) + typedef std::map GdkPixbufMap; + GdkPixbufMap gdk_pixbufs_; +#endif + + // The various fonts used. Cached to avoid repeated GDI creation/destruction. + scoped_ptr base_font_; + scoped_ptr small_font_; + scoped_ptr medium_font_; + scoped_ptr medium_bold_font_; + scoped_ptr large_font_; + scoped_ptr web_font_; + + static ResourceBundle* g_shared_instance_; + + scoped_ptr theme_extension_; + + DISALLOW_EVIL_CONSTRUCTORS(ResourceBundle); +}; + +#endif // CHROME_COMMON_RESOURCE_BUNDLE_H__ diff --git a/app/resource_bundle_linux.cc b/app/resource_bundle_linux.cc new file mode 100644 index 0000000..9c866b2 --- /dev/null +++ b/app/resource_bundle_linux.cc @@ -0,0 +1,209 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "app/resource_bundle.h" + +#include + +#include "base/base_paths.h" +#include "base/data_pack.h" +#include "base/file_path.h" +#include "base/file_util.h" +#include "base/gfx/gtk_util.h" +#include "base/logging.h" +#include "base/path_service.h" +#include "base/string_piece.h" +#include "base/string_util.h" +#include "chrome/common/chrome_paths.h" +#include "chrome/common/gfx/chrome_font.h" +#include "chrome/common/gtk_util.h" +#include "chrome/common/l10n_util.h" +#include "SkBitmap.h" + +namespace { + +// Convert the raw image data into a GdkPixbuf. The GdkPixbuf that is returned +// has a ref count of 1 so the caller must call g_object_unref to free the +// memory. +GdkPixbuf* LoadPixbuf(std::vector& data) { + ScopedGObject::Type loader(gdk_pixbuf_loader_new()); + bool ok = gdk_pixbuf_loader_write(loader.get(), + static_cast(data.data()), data.size(), NULL); + if (!ok) + return NULL; + // Calling gdk_pixbuf_loader_close forces the data to be parsed by the + // loader. We must do this before calling gdk_pixbuf_loader_get_pixbuf. + ok = gdk_pixbuf_loader_close(loader.get(), NULL); + if (!ok) + return NULL; + GdkPixbuf* pixbuf = gdk_pixbuf_loader_get_pixbuf(loader.get()); + if (!pixbuf) + return NULL; + + // The pixbuf is owned by the loader, so add a ref so when we delete the + // loader (when the ScopedGObject goes out of scope), the pixbuf still + // exists. + g_object_ref(pixbuf); + + return pixbuf; +} + +} // namespace + +ResourceBundle::~ResourceBundle() { + FreeImages(); + // Free GdkPixbufs. + for (GdkPixbufMap::iterator i = gdk_pixbufs_.begin(); + i != gdk_pixbufs_.end(); i++) { + g_object_unref(i->second); + } + gdk_pixbufs_.clear(); + + delete locale_resources_data_; + locale_resources_data_ = NULL; + delete theme_data_; + theme_data_ = NULL; + delete resources_data_; + resources_data_ = NULL; +} + +void ResourceBundle::LoadResources(const std::wstring& pref_locale) { + FilePath resources_data_path; + PathService::Get(base::DIR_EXE, &resources_data_path); + resources_data_path = resources_data_path.Append( + FILE_PATH_LITERAL("chrome.pak")); + DCHECK(resources_data_ == NULL) << "resource data already loaded!"; + resources_data_ = new base::DataPack; + bool success = resources_data_->Load(resources_data_path); + DCHECK(success) << "failed to load chrome.pak"; + + DCHECK(locale_resources_data_ == NULL) << "locale data already loaded!"; + const FilePath& locale_path = GetLocaleFilePath(pref_locale); + if (locale_path.value().empty()) { + // It's possible that there are no locale dlls found, in which case we just + // return. + NOTREACHED(); + return; + } + + locale_resources_data_ = new base::DataPack; + success = locale_resources_data_->Load(locale_path); + DCHECK(success) << "failed to load locale pak file"; +} + +FilePath ResourceBundle::GetLocaleFilePath(const std::wstring& pref_locale) { + FilePath locale_path; + PathService::Get(chrome::DIR_LOCALES, &locale_path); + + const std::wstring app_locale = l10n_util::GetApplicationLocale(pref_locale); + if (app_locale.empty()) + return FilePath(); + + return locale_path.Append(WideToASCII(app_locale + L".pak")); +} + +void ResourceBundle::LoadThemeResources() { + FilePath theme_data_path; + PathService::Get(chrome::DIR_THEMES, &theme_data_path); + theme_data_path = theme_data_path.Append(FILE_PATH_LITERAL("default.pak")); + theme_data_ = new base::DataPack; + bool success = theme_data_->Load(theme_data_path); + DCHECK(success) << "failed to load theme data"; +} + +/* static */ +bool ResourceBundle::LoadResourceBytes(DataHandle module, int resource_id, + std::vector* bytes) { + DCHECK(module); + StringPiece data; + if (!module->Get(resource_id, &data)) + return false; + + bytes->resize(data.length()); + memcpy(&(bytes->front()), data.data(), data.length()); + + return true; +} + +StringPiece ResourceBundle::GetRawDataResource(int resource_id) { + DCHECK(resources_data_); + StringPiece data; + if (!resources_data_->Get(resource_id, &data)) + return StringPiece(); + return data; +} + +string16 ResourceBundle::GetLocalizedString(int message_id) { + // If for some reason we were unable to load a resource dll, return an empty + // string (better than crashing). + if (!locale_resources_data_) { + LOG(WARNING) << "locale resources are not loaded"; + return string16(); + } + + StringPiece data; + if (!locale_resources_data_->Get(message_id, &data)) { + // Fall back on the main data pack (shouldn't be any strings here except in + // unittests). + data = GetRawDataResource(message_id); + if (data.empty()) { + NOTREACHED() << "unable to find resource: " << message_id; + return string16(); + } + } + + // Data pack encodes strings as UTF16. + string16 msg(reinterpret_cast(data.data()), + data.length() / 2); + return msg; +} + +GdkPixbuf* ResourceBundle::GetPixbufNamed(int resource_id) { + // Check to see if we already have the pixbuf in the cache. + { + AutoLock lock_scope(lock_); + GdkPixbufMap::const_iterator found = gdk_pixbufs_.find(resource_id); + if (found != gdk_pixbufs_.end()) + return found->second; + } + + + std::vector data; + LoadImageResourceBytes(resource_id, &data); + GdkPixbuf* pixbuf = LoadPixbuf(data); + + // We loaded successfully. Cache the pixbuf. + if (pixbuf) { + AutoLock lock_scope(lock_); + + // Another thread raced us, and has already cached the pixbuf. + if (gdk_pixbufs_.count(resource_id)) { + g_object_unref(pixbuf); + return gdk_pixbufs_[resource_id]; + } + + gdk_pixbufs_[resource_id] = pixbuf; + return pixbuf; + } + + // We failed to retrieve the bitmap, show a debugging red square. + { + LOG(WARNING) << "Unable to load GdkPixbuf with id " << resource_id; + NOTREACHED(); // Want to assert in debug mode. + + AutoLock lock_scope(lock_); // Guard empty_bitmap initialization. + + static GdkPixbuf* empty_bitmap = NULL; + if (!empty_bitmap) { + // The placeholder bitmap is bright red so people notice the problem. + // This bitmap will be leaked, but this code should never be hit. + scoped_ptr skia_bitmap(new SkBitmap()); + skia_bitmap->setConfig(SkBitmap::kARGB_8888_Config, 32, 32); + skia_bitmap->allocPixels(); + skia_bitmap->eraseARGB(255, 255, 0, 0); + empty_bitmap = gfx::GdkPixbufFromSkBitmap(skia_bitmap.get()); + } + return empty_bitmap; + } +} diff --git a/app/resource_bundle_mac.mm b/app/resource_bundle_mac.mm new file mode 100644 index 0000000..d24271c --- /dev/null +++ b/app/resource_bundle_mac.mm @@ -0,0 +1,120 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "app/resource_bundle.h" + +#import + +#include "base/base_paths.h" +#include "base/data_pack.h" +#include "base/file_path.h" +#include "base/file_util.h" +#include "base/logging.h" +#include "base/mac_util.h" +#include "base/path_service.h" +#include "base/string_piece.h" +#include "base/string_util.h" +#include "chrome/common/chrome_paths.h" +#include "chrome/common/gfx/chrome_font.h" +#include "chrome/common/l10n_util.h" + + +ResourceBundle::~ResourceBundle() { + FreeImages(); + + delete locale_resources_data_; + locale_resources_data_ = NULL; + delete theme_data_; + theme_data_ = NULL; + delete resources_data_; + resources_data_ = NULL; +} + +namespace { + +base::DataPack *LoadResourceDataPack(NSString *name) { + base::DataPack *resource_pack = NULL; + + NSString *resource_path = [mac_util::MainAppBundle() pathForResource:name + ofType:@"pak"]; + if (resource_path) { + FilePath resources_pak_path([resource_path fileSystemRepresentation]); + resource_pack = new base::DataPack; + bool success = resource_pack->Load(resources_pak_path); + if (!success) { + delete resource_pack; + resource_pack = NULL; + } + } + + return resource_pack; +} + +} // namespace + +void ResourceBundle::LoadResources(const std::wstring& pref_locale) { + DLOG_IF(WARNING, pref_locale.size() != 0) + << "ignoring requested locale in favor of NSBundle's selection"; + + DCHECK(resources_data_ == NULL) << "resource data already loaded!"; + resources_data_ = LoadResourceDataPack(@"chrome"); + DCHECK(resources_data_) << "failed to load chrome.pak"; + + DCHECK(locale_resources_data_ == NULL) << "locale data already loaded!"; + locale_resources_data_ = LoadResourceDataPack(@"locale"); + DCHECK(locale_resources_data_) << "failed to load locale.pak"; +} + +void ResourceBundle::LoadThemeResources() { + DCHECK(theme_data_ == NULL) << "theme data already loaded!"; + theme_data_ = LoadResourceDataPack(@"theme"); + DCHECK(theme_data_) << "failed to load theme.pak"; +} + +/* static */ +bool ResourceBundle::LoadResourceBytes(DataHandle module, int resource_id, + std::vector* bytes) { + DCHECK(module); + StringPiece data; + if (!module->Get(resource_id, &data)) + return false; + + bytes->resize(data.length()); + memcpy(&(bytes->front()), data.data(), data.length()); + + return true; +} + +StringPiece ResourceBundle::GetRawDataResource(int resource_id) { + DCHECK(resources_data_); + StringPiece data; + if (!resources_data_->Get(resource_id, &data)) + return StringPiece(); + return data; +} + +string16 ResourceBundle::GetLocalizedString(int message_id) { + // If for some reason we were unable to load a resource dll, return an empty + // string (better than crashing). + if (!locale_resources_data_) { + LOG(WARNING) << "locale resources are not loaded"; + return string16(); + } + + StringPiece data; + if (!locale_resources_data_->Get(message_id, &data)) { + // Fall back on the main data pack (shouldn't be any strings here except in + // unittests). + data = GetRawDataResource(message_id); + if (data.empty()) { + NOTREACHED() << "unable to find resource: " << message_id; + return string16(); + } + } + + // Data pack encodes strings as UTF16. + string16 msg(reinterpret_cast(data.data()), + data.length() / 2); + return msg; +} diff --git a/app/resource_bundle_win.cc b/app/resource_bundle_win.cc new file mode 100644 index 0000000..dff34c8 --- /dev/null +++ b/app/resource_bundle_win.cc @@ -0,0 +1,157 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "app/resource_bundle.h" + +#include + +#include "base/file_util.h" +#include "base/logging.h" +#include "base/path_service.h" +#include "base/resource_util.h" +#include "base/string_piece.h" +#include "base/win_util.h" +#include "chrome/common/chrome_paths.h" +#include "chrome/common/l10n_util.h" + +namespace { + +// Returns the flags that should be passed to LoadLibraryEx. +DWORD GetDataDllLoadFlags() { + if (win_util::GetWinVersion() >= win_util::WINVERSION_VISTA) + return LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE | LOAD_LIBRARY_AS_IMAGE_RESOURCE; + + return DONT_RESOLVE_DLL_REFERENCES; +} + +} // end anonymous namespace + +ResourceBundle::~ResourceBundle() { + FreeImages(); + + if (locale_resources_data_) { + BOOL rv = FreeLibrary(locale_resources_data_); + DCHECK(rv); + } + if (theme_data_) { + BOOL rv = FreeLibrary(theme_data_); + DCHECK(rv); + } +} + +void ResourceBundle::LoadResources(const std::wstring& pref_locale) { + // As a convenience, set resources_data_ to the current module. + resources_data_ = _AtlBaseModule.GetModuleInstance(); + + DCHECK(NULL == locale_resources_data_) << "locale dll already loaded"; + const FilePath& locale_path = GetLocaleFilePath(pref_locale); + if (locale_path.value().empty()) { + // It's possible that there are no locale dlls found, in which case we just + // return. + NOTREACHED(); + return; + } + + // The dll should only have resources, not executable code. + locale_resources_data_ = LoadLibraryEx(locale_path.value().c_str(), NULL, + GetDataDllLoadFlags()); + DCHECK(locale_resources_data_ != NULL) << + "unable to load generated resources"; +} + +FilePath ResourceBundle::GetLocaleFilePath(const std::wstring& pref_locale) { + FilePath locale_path; + PathService::Get(chrome::DIR_LOCALES, &locale_path); + + const std::wstring app_locale = l10n_util::GetApplicationLocale(pref_locale); + if (app_locale.empty()) + return FilePath(); + + return locale_path.Append(app_locale + L".dll"); +} + +void ResourceBundle::LoadThemeResources() { + DCHECK(NULL == theme_data_) << "theme dll already loaded"; + std::wstring theme_data_path; + PathService::Get(chrome::DIR_THEMES, &theme_data_path); + file_util::AppendToPath(&theme_data_path, L"default.dll"); + + // The dll should only have resources, not executable code. + theme_data_ = LoadLibraryEx(theme_data_path.c_str(), NULL, + GetDataDllLoadFlags()); + DCHECK(theme_data_ != NULL) << "unable to load " << theme_data_path; +} + +/* static */ +bool ResourceBundle::LoadResourceBytes( + DataHandle module, + int resource_id, + std::vector* bytes) { + void* data_ptr; + size_t data_size; + if (base::GetDataResourceFromModule(module, resource_id, &data_ptr, + &data_size)) { + bytes->resize(data_size); + memcpy(&(bytes->front()), data_ptr, data_size); + return true; + } else { + return false; + } +} + +HICON ResourceBundle::LoadThemeIcon(int icon_id) { + return ::LoadIcon(theme_data_, MAKEINTRESOURCE(icon_id)); +} + +StringPiece ResourceBundle::GetRawDataResource(int resource_id) { + void* data_ptr; + size_t data_size; + if (base::GetDataResourceFromModule(_AtlBaseModule.GetModuleInstance(), + resource_id, + &data_ptr, + &data_size)) { + return StringPiece(static_cast(data_ptr), data_size); + } else if (locale_resources_data_ && + base::GetDataResourceFromModule(locale_resources_data_, + resource_id, + &data_ptr, + &data_size)) { + return StringPiece(static_cast(data_ptr), data_size); + } + return StringPiece(); +} + +// Loads and returns a cursor from the current module. +HCURSOR ResourceBundle::LoadCursor(int cursor_id) { + return ::LoadCursor(_AtlBaseModule.GetModuleInstance(), + MAKEINTRESOURCE(cursor_id)); +} + +string16 ResourceBundle::GetLocalizedString(int message_id) { + // If for some reason we were unable to load a resource dll, return an empty + // string (better than crashing). + if (!locale_resources_data_) { + LOG(WARNING) << "locale resources are not loaded"; + return string16(); + } + + DCHECK(IS_INTRESOURCE(message_id)); + + // Get a reference directly to the string resource. + HINSTANCE hinstance = locale_resources_data_; + const ATLSTRINGRESOURCEIMAGE* image = AtlGetStringResourceImage(hinstance, + message_id); + if (!image) { + // Fall back on the current module (shouldn't be any strings here except + // in unittests). + image = AtlGetStringResourceImage(_AtlBaseModule.GetModuleInstance(), + message_id); + if (!image) { + NOTREACHED() << "unable to find resource: " << message_id; + return std::wstring(); + } + } + // Copy into a string16 and return. + return string16(image->achString, image->nLength); +} diff --git a/chrome/DEPS b/chrome/DEPS index e90dc1b..5c73a5a0 100644 --- a/chrome/DEPS +++ b/chrome/DEPS @@ -1,4 +1,5 @@ include_rules = [ + "+app", "+net", "+printing", diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc index 481f334..ab6dba0 100644 --- a/chrome/app/chrome_dll_main.cc +++ b/chrome/app/chrome_dll_main.cc @@ -26,6 +26,7 @@ #include #endif +#include "app/resource_bundle.h" #include "base/at_exit.h" #include "base/command_line.h" #include "base/debug_util.h" @@ -51,7 +52,6 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/logging_chrome.h" #include "chrome/common/main_function_params.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/sandbox_init_wrapper.h" #if defined(OS_WIN) #include "sandbox/src/sandbox.h" diff --git a/chrome/browser/alternate_nav_url_fetcher.cc b/chrome/browser/alternate_nav_url_fetcher.cc index b134e1b..452c4c6 100644 --- a/chrome/browser/alternate_nav_url_fetcher.cc +++ b/chrome/browser/alternate_nav_url_fetcher.cc @@ -4,12 +4,12 @@ #include "chrome/browser/alternate_nav_url_fetcher.h" +#include "app/resource_bundle.h" #include "chrome/browser/tab_contents/navigation_controller.h" #include "chrome/browser/tab_contents/navigation_entry.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/l10n_util.h" #include "chrome/common/notification_service.h" -#include "chrome/common/resource_bundle.h" #include "grit/generated_resources.h" AlternateNavURLFetcher::AlternateNavURLFetcher( diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc index 656907a..70e13052 100644 --- a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc +++ b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc @@ -8,6 +8,7 @@ #include +#include "app/resource_bundle.h" #include "base/basictypes.h" #include "base/gfx/gtk_util.h" #include "base/gfx/rect.h" @@ -22,7 +23,6 @@ #include "chrome/browser/search_engines/template_url_model.h" #include "chrome/common/gfx/chrome_font.h" #include "chrome/common/notification_service.h" -#include "chrome/common/resource_bundle.h" #include "grit/theme_resources.h" namespace { @@ -256,13 +256,13 @@ AutocompletePopupViewGtk::AutocompletePopupViewGtk( GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK); - g_signal_connect(window_, "motion-notify-event", + g_signal_connect(window_, "motion-notify-event", G_CALLBACK(&HandleMotionThunk), this); - g_signal_connect(window_, "button-press-event", + g_signal_connect(window_, "button-press-event", G_CALLBACK(&HandleButtonPressThunk), this); - g_signal_connect(window_, "button-release-event", + g_signal_connect(window_, "button-release-event", G_CALLBACK(&HandleButtonReleaseThunk), this); - g_signal_connect(window_, "expose-event", + g_signal_connect(window_, "expose-event", G_CALLBACK(&HandleExposeThunk), this); } diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_win.cc b/chrome/browser/autocomplete/autocomplete_popup_view_win.cc index 268d4cd..82988718 100644 --- a/chrome/browser/autocomplete/autocomplete_popup_view_win.cc +++ b/chrome/browser/autocomplete/autocomplete_popup_view_win.cc @@ -11,6 +11,7 @@ #include #include +#include "app/resource_bundle.h" #include "base/command_line.h" #include "base/string_util.h" #include "base/win_util.h" @@ -29,7 +30,6 @@ #include "chrome/common/gfx/chrome_font.h" #include "chrome/common/l10n_util.h" #include "chrome/common/notification_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/view.h" #include "grit/theme_resources.h" #include "third_party/icu38/public/common/unicode/ubidi.h" diff --git a/chrome/browser/bookmarks/bookmark_folder_tree_model.cc b/chrome/browser/bookmarks/bookmark_folder_tree_model.cc index de09b13..d86d52f 100644 --- a/chrome/browser/bookmarks/bookmark_folder_tree_model.cc +++ b/chrome/browser/bookmarks/bookmark_folder_tree_model.cc @@ -4,8 +4,8 @@ #include "chrome/browser/bookmarks/bookmark_folder_tree_model.h" +#include "app/resource_bundle.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" diff --git a/chrome/browser/bookmarks/bookmark_menu_controller.cc b/chrome/browser/bookmarks/bookmark_menu_controller.cc index 53f2007..0fcaa98d6 100644 --- a/chrome/browser/bookmarks/bookmark_menu_controller.cc +++ b/chrome/browser/bookmarks/bookmark_menu_controller.cc @@ -4,6 +4,7 @@ #include "chrome/browser/bookmarks/bookmark_menu_controller.h" +#include "app/resource_bundle.h" #include "chrome/browser/bookmarks/bookmark_drag_data.h" #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/metrics/user_metrics.h" @@ -13,7 +14,6 @@ #include "chrome/common/os_exchange_data.h" #include "chrome/common/l10n_util.h" #include "chrome/common/page_transition_types.h" -#include "chrome/common/resource_bundle.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" diff --git a/chrome/browser/bookmarks/bookmark_table_model.cc b/chrome/browser/bookmarks/bookmark_table_model.cc index 2f294b1..24e0d53 100644 --- a/chrome/browser/bookmarks/bookmark_table_model.cc +++ b/chrome/browser/bookmarks/bookmark_table_model.cc @@ -6,11 +6,11 @@ #include +#include "app/resource_bundle.h" #include "base/string_util.h" #include "base/time_format.h" #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "googleurl/src/gurl.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index 8c34b3f..9321958 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -7,6 +7,7 @@ #include #include +#include "app/resource_bundle.h" #include "base/file_version_info.h" #include "base/histogram.h" #include "base/platform_thread.h" @@ -27,7 +28,6 @@ #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "chrome/common/render_messages.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/url_constants.h" #include "chrome/renderer/about_handler.h" #include "googleurl/src/gurl.h" diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc index 8adb962..00d265d 100644 --- a/chrome/browser/browser_init.cc +++ b/chrome/browser/browser_init.cc @@ -4,6 +4,7 @@ #include "chrome/browser/browser_init.h" +#include "app/resource_bundle.h" #include "base/basictypes.h" #include "base/command_line.h" #include "base/event_recorder.h" @@ -37,7 +38,6 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/result_codes.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -140,8 +140,8 @@ class NotifyNotDefaultBrowserTask : public Task { } TabContents* tab = browser->GetSelectedTabContents(); // Don't show the info-bar if there are already info-bars showing. - // In ChromeBot tests, there might be a race. This line appears to get - // called during shutdown and |tab| can be NULL. + // In ChromeBot tests, there might be a race. This line appears to get + // called during shutdown and |tab| can be NULL. if (!tab || tab->infobar_delegate_count() > 0) return; tab->AddInfoBar(new DefaultBrowserInfoBarDelegate(tab)); diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 6b27a9d..0588bf5d 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -6,6 +6,7 @@ #include +#include "app/resource_bundle.h" #include "base/command_line.h" #include "base/field_trial.h" #include "base/file_util.h" @@ -45,7 +46,6 @@ #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "chrome/common/result_codes.h" -#include "chrome/common/resource_bundle.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/net_resources.h" diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc index c37a975..8ef0dbe 100644 --- a/chrome/browser/browser_shutdown.cc +++ b/chrome/browser/browser_shutdown.cc @@ -4,6 +4,7 @@ #include "chrome/browser/browser_shutdown.h" +#include "app/resource_bundle.h" #include "base/file_path.h" #include "base/file_util.h" #include "base/histogram.h" @@ -25,7 +26,6 @@ #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "chrome/common/chrome_plugin_lib.h" -#include "chrome/common/resource_bundle.h" #include "net/dns_global.h" diff --git a/chrome/browser/debugger/debugger_shell.cc b/chrome/browser/debugger/debugger_shell.cc index fc89a94..d6d5324 100644 --- a/chrome/browser/debugger/debugger_shell.cc +++ b/chrome/browser/debugger/debugger_shell.cc @@ -6,6 +6,7 @@ #include "build/build_config.h" +#include "app/resource_bundle.h" #include "base/file_util.h" #include "base/path_service.h" #include "base/string_util.h" @@ -18,7 +19,6 @@ #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/chrome_paths.h" -#include "chrome/common/resource_bundle.h" #include "grit/debugger_resources.h" diff --git a/chrome/browser/debugger/debugger_view.cc b/chrome/browser/debugger/debugger_view.cc index bf3dc09..003e3d2 100644 --- a/chrome/browser/debugger/debugger_view.cc +++ b/chrome/browser/debugger/debugger_view.cc @@ -4,6 +4,7 @@ #include "chrome/browser/debugger/debugger_view.h" +#include "app/resource_bundle.h" #include "base/logging.h" #include "base/string_util.h" #include "base/json_writer.h" @@ -20,7 +21,6 @@ #include "chrome/browser/views/standard_layout.h" #include "chrome/browser/views/tab_contents_container_view.h" #include "chrome/common/gfx/chrome_canvas.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/grid_layout.h" #include "chrome/views/controls/scrollbar/native_scroll_bar.h" #include "chrome/views/controls/scroll_view.h" @@ -162,4 +162,3 @@ bool DebuggerView::AcceleratorPressed(const views::Accelerator& accelerator) { window_->window()->Close(); return true; } - diff --git a/chrome/browser/dom_ui/debugger_ui.cc b/chrome/browser/dom_ui/debugger_ui.cc index c20286a..7467571 100644 --- a/chrome/browser/dom_ui/debugger_ui.cc +++ b/chrome/browser/dom_ui/debugger_ui.cc @@ -4,6 +4,7 @@ #include "chrome/browser/dom_ui/debugger_ui.h" +#include "app/resource_bundle.h" #include "base/command_line.h" #include "base/file_util.h" #include "base/string_util.h" @@ -13,7 +14,6 @@ #include "chrome/browser/debugger/debugger_wrapper.h" #include "chrome/browser/dom_ui/chrome_url_data_manager.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/url_constants.h" #include "net/base/mime_util.h" diff --git a/chrome/browser/dom_ui/dom_ui_favicon_source.cc b/chrome/browser/dom_ui/dom_ui_favicon_source.cc index d9ba79e..233bd83 100644 --- a/chrome/browser/dom_ui/dom_ui_favicon_source.cc +++ b/chrome/browser/dom_ui/dom_ui_favicon_source.cc @@ -4,8 +4,8 @@ #include "chrome/browser/dom_ui/dom_ui_favicon_source.h" +#include "app/resource_bundle.h" #include "chrome/browser/profile.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/url_constants.h" #include "grit/theme_resources.h" @@ -60,4 +60,3 @@ void DOMUIFavIconSource::OnFavIconDataAvailable( SendResponse(request_id, default_favicon_); } } - diff --git a/chrome/browser/dom_ui/dom_ui_thumbnail_source.cc b/chrome/browser/dom_ui/dom_ui_thumbnail_source.cc index 45b4bf3..df9c675 100644 --- a/chrome/browser/dom_ui/dom_ui_thumbnail_source.cc +++ b/chrome/browser/dom_ui/dom_ui_thumbnail_source.cc @@ -4,8 +4,8 @@ #include "chrome/browser/dom_ui/dom_ui_thumbnail_source.h" +#include "app/resource_bundle.h" #include "chrome/browser/profile.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/url_constants.h" #include "googleurl/src/gurl.h" #include "grit/theme_resources.h" @@ -50,4 +50,3 @@ void DOMUIThumbnailSource::OnThumbnailDataAvailable( SendResponse(request_id, default_thumbnail_); } } - diff --git a/chrome/browser/dom_ui/fileicon_source.h b/chrome/browser/dom_ui/fileicon_source.h index 4da8c41..423efcb 100644 --- a/chrome/browser/dom_ui/fileicon_source.h +++ b/chrome/browser/dom_ui/fileicon_source.h @@ -5,8 +5,8 @@ #ifndef CHROME_BROWSER_DOM_UI_FILEICON_SOURCE_H_ #define CHROME_BROWSER_DOM_UI_FILEICON_SOURCE_H_ +#include "app/resource_bundle.h" #include "chrome/browser/dom_ui/chrome_url_data_manager.h" -#include "chrome/common/resource_bundle.h" #if defined(OS_WIN) #include "chrome/browser/icon_manager.h" diff --git a/chrome/browser/dom_ui/history_ui.cc b/chrome/browser/dom_ui/history_ui.cc index 25f84ba..ee7b3b9 100644 --- a/chrome/browser/dom_ui/history_ui.cc +++ b/chrome/browser/dom_ui/history_ui.cc @@ -4,6 +4,7 @@ #include "chrome/browser/dom_ui/history_ui.h" +#include "app/resource_bundle.h" #include "base/message_loop.h" #include "base/string_piece.h" #include "base/string_util.h" @@ -19,7 +20,6 @@ #include "chrome/common/jstemplate_builder.h" #include "chrome/common/l10n_util.h" #include "chrome/common/notification_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/time_format.h" #include "chrome/common/url_constants.h" #include "net/base/escape.h" diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc index a187560..03091d3 100644 --- a/chrome/browser/dom_ui/new_tab_ui.cc +++ b/chrome/browser/dom_ui/new_tab_ui.cc @@ -6,6 +6,7 @@ #include "chrome/browser/dom_ui/new_tab_ui.h" +#include "app/resource_bundle.h" #include "base/histogram.h" #include "base/string_piece.h" #include "chrome/browser/bookmarks/bookmark_model.h" @@ -31,7 +32,6 @@ #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/url_constants.h" #ifdef CHROME_PERSONALIZATION #include "chrome/personalization/personalization.h" diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc index 9b6da6b..f97a5bf 100644 --- a/chrome/browser/download/download_util.cc +++ b/chrome/browser/download/download_util.cc @@ -8,6 +8,7 @@ #include "chrome/browser/download/download_util.h" +#include "app/resource_bundle.h" #include "base/base_drag_source.h" #include "base/file_util.h" #include "base/scoped_clipboard_writer.h" @@ -20,7 +21,6 @@ #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/l10n_util.h" #include "chrome/common/os_exchange_data.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/view.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" diff --git a/chrome/browser/drag_utils.cc b/chrome/browser/drag_utils.cc index 808a506..813c291 100644 --- a/chrome/browser/drag_utils.cc +++ b/chrome/browser/drag_utils.cc @@ -8,6 +8,7 @@ #include #include +#include "app/resource_bundle.h" #include "base/file_util.h" #include "base/gfx/gdi_util.h" #include "base/gfx/point.h" @@ -17,7 +18,6 @@ #include "chrome/common/gfx/chrome_font.h" #include "chrome/common/l10n_util.h" #include "chrome/common/os_exchange_data.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" #include "chrome/views/controls/button/text_button.h" #include "googleurl/src/gurl.h" diff --git a/chrome/browser/extensions/extension.cc b/chrome/browser/extensions/extension.cc index 35b169e..280b32f 100644 --- a/chrome/browser/extensions/extension.cc +++ b/chrome/browser/extensions/extension.cc @@ -4,6 +4,7 @@ #include "chrome/browser/extensions/extension.h" +#include "app/resource_bundle.h" #include "base/file_path.h" #include "base/file_util.h" #include "base/logging.h" @@ -11,7 +12,6 @@ #include "net/base/net_util.h" #include "chrome/browser/extensions/extension_error_reporter.h" #include "chrome/common/extensions/user_script.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/url_constants.h" const char Extension::kManifestFilename[] = "manifest.json"; diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index 8cfec94..4e5f615a 100755 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -4,6 +4,7 @@ #include "chrome/browser/extensions/extension_host.h" +#include "app/resource_bundle.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/extensions/extension.h" @@ -19,7 +20,6 @@ #include "chrome/browser/tab_contents/tab_contents_view.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "grit/browser_resources.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/extensions/extensions_ui.cc b/chrome/browser/extensions/extensions_ui.cc index c73bdc6..4a03e06 100644 --- a/chrome/browser/extensions/extensions_ui.cc +++ b/chrome/browser/extensions/extensions_ui.cc @@ -4,6 +4,7 @@ #include "chrome/browser/extensions/extensions_ui.h" +#include "app/resource_bundle.h" #include "base/thread.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/extensions_service.h" @@ -12,7 +13,6 @@ #include "chrome/common/extensions/url_pattern.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/url_constants.h" #include "net/base/net_util.h" diff --git a/chrome/browser/first_run.cc b/chrome/browser/first_run.cc index 8a93bd3..8bb247a 100644 --- a/chrome/browser/first_run.cc +++ b/chrome/browser/first_run.cc @@ -11,6 +11,7 @@ #include "chrome/browser/first_run.h" +#include "app/resource_bundle.h" #include "base/command_line.h" #include "base/file_util.h" #include "base/logging.h" @@ -34,7 +35,6 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/result_codes.h" #include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/google_update_constants.h" diff --git a/chrome/browser/gtk/about_chrome_dialog.cc b/chrome/browser/gtk/about_chrome_dialog.cc index 0650259..5be8e40 100644 --- a/chrome/browser/gtk/about_chrome_dialog.cc +++ b/chrome/browser/gtk/about_chrome_dialog.cc @@ -7,10 +7,10 @@ #include #include +#include "app/resource_bundle.h" #include "base/file_version_info.h" #include "base/gfx/gtk_util.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/chrome_constants.h" #include "chrome/browser/profile.h" #include "grit/chromium_strings.h" diff --git a/chrome/browser/gtk/bookmark_bar_gtk.cc b/chrome/browser/gtk/bookmark_bar_gtk.cc index 85a6bb7..a6ca59e 100644 --- a/chrome/browser/gtk/bookmark_bar_gtk.cc +++ b/chrome/browser/gtk/bookmark_bar_gtk.cc @@ -4,6 +4,7 @@ #include "chrome/browser/gtk/bookmark_bar_gtk.h" +#include "app/resource_bundle.h" #include "base/gfx/gtk_util.h" #include "chrome/browser/bookmarks/bookmark_context_menu.h" #include "chrome/browser/bookmarks/bookmark_utils.h" @@ -17,7 +18,6 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" diff --git a/chrome/browser/gtk/browser_toolbar_gtk.cc b/chrome/browser/gtk/browser_toolbar_gtk.cc index 5f42f77..62a5e7f 100644 --- a/chrome/browser/gtk/browser_toolbar_gtk.cc +++ b/chrome/browser/gtk/browser_toolbar_gtk.cc @@ -6,6 +6,7 @@ #include +#include "app/resource_bundle.h" #include "base/logging.h" #include "base/base_paths_linux.h" #include "base/path_service.h" @@ -26,7 +27,6 @@ #include "chrome/common/notification_type.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc index ceb2561..f8887a0 100644 --- a/chrome/browser/gtk/browser_window_gtk.cc +++ b/chrome/browser/gtk/browser_window_gtk.cc @@ -6,6 +6,7 @@ #include +#include "app/resource_bundle.h" #include "base/base_paths_linux.h" #include "base/command_line.h" #include "base/gfx/gtk_util.h" @@ -36,7 +37,6 @@ #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/controls/button/text_button.h" #include "grit/theme_resources.h" diff --git a/chrome/browser/gtk/custom_button.cc b/chrome/browser/gtk/custom_button.cc index d3e9c35..fd263af 100644 --- a/chrome/browser/gtk/custom_button.cc +++ b/chrome/browser/gtk/custom_button.cc @@ -4,8 +4,8 @@ #include "chrome/browser/gtk/custom_button.h" +#include "app/resource_bundle.h" #include "base/basictypes.h" -#include "chrome/common/resource_bundle.h" #include "chrome/browser/gtk/nine_box.h" #include "grit/theme_resources.h" diff --git a/chrome/browser/gtk/download_shelf_gtk.cc b/chrome/browser/gtk/download_shelf_gtk.cc index 01636d8..b476508 100644 --- a/chrome/browser/gtk/download_shelf_gtk.cc +++ b/chrome/browser/gtk/download_shelf_gtk.cc @@ -4,6 +4,7 @@ #include "chrome/browser/gtk/download_shelf_gtk.h" +#include "app/resource_bundle.h" #include "base/gfx/gtk_util.h" #include "chrome/browser/download/download_item_model.h" #include "chrome/browser/gtk/custom_button.h" @@ -12,7 +13,6 @@ #include "chrome/browser/gtk/slide_animator_gtk.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" diff --git a/chrome/browser/gtk/nine_box.cc b/chrome/browser/gtk/nine_box.cc index d957bfb..901ca68 100644 --- a/chrome/browser/gtk/nine_box.cc +++ b/chrome/browser/gtk/nine_box.cc @@ -4,10 +4,10 @@ #include "chrome/browser/gtk/nine_box.h" +#include "app/resource_bundle.h" #include "base/gfx/gtk_util.h" #include "base/gfx/point.h" #include "base/logging.h" -#include "chrome/common/resource_bundle.h" namespace { diff --git a/chrome/browser/gtk/tabs/tab_gtk.cc b/chrome/browser/gtk/tabs/tab_gtk.cc index 4a644b3..9966d0f 100644 --- a/chrome/browser/gtk/tabs/tab_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_gtk.cc @@ -4,10 +4,10 @@ #include "chrome/browser/gtk/tabs/tab_gtk.h" +#include "app/resource_bundle.h" #include "chrome/browser/gtk/menu_gtk.h" #include "chrome/common/gfx/path.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc index 1f48684..1ce7aaf 100644 --- a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc @@ -4,11 +4,11 @@ #include "chrome/browser/gtk/tabs/tab_renderer_gtk.h" +#include "app/resource_bundle.h" #include "chrome/browser/browser.h" #include "chrome/browser/profile.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "skia/ext/image_operations.h" diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/gtk/tabs/tab_strip_gtk.cc index c9b12e3..33627b6 100644 --- a/chrome/browser/gtk/tabs/tab_strip_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_strip_gtk.cc @@ -4,6 +4,7 @@ #include "chrome/browser/gtk/tabs/tab_strip_gtk.h" +#include "app/resource_bundle.h" #include "base/gfx/gtk_util.h" #include "base/gfx/point.h" #include "chrome/browser/browser.h" @@ -11,7 +12,6 @@ #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/slide_animation.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" diff --git a/chrome/browser/gtk/toolbar_star_toggle_gtk.cc b/chrome/browser/gtk/toolbar_star_toggle_gtk.cc index 92cfc16..11ebfae 100644 --- a/chrome/browser/gtk/toolbar_star_toggle_gtk.cc +++ b/chrome/browser/gtk/toolbar_star_toggle_gtk.cc @@ -4,9 +4,9 @@ #include "chrome/browser/gtk/toolbar_star_toggle_gtk.h" +#include "app/resource_bundle.h" #include "base/gfx/rect.h" #include "chrome/browser/gtk/bookmark_bubble_gtk.h" -#include "chrome/common/resource_bundle.h" #include "grit/theme_resources.h" ToolbarStarToggleGtk::ToolbarStarToggleGtk() diff --git a/chrome/browser/password_manager/password_manager.cc b/chrome/browser/password_manager/password_manager.cc index 1e7339d..265e2de 100644 --- a/chrome/browser/password_manager/password_manager.cc +++ b/chrome/browser/password_manager/password_manager.cc @@ -4,6 +4,7 @@ #include "chrome/browser/password_manager/password_manager.h" +#include "app/resource_bundle.h" #include "base/string_util.h" #include "chrome/browser/profile.h" #include "chrome/browser/tab_contents/tab_contents.h" @@ -12,7 +13,6 @@ #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/stl_util-inl.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/plugin_installer.cc b/chrome/browser/plugin_installer.cc index e8ba426..aa803b4 100644 --- a/chrome/browser/plugin_installer.cc +++ b/chrome/browser/plugin_installer.cc @@ -4,10 +4,10 @@ #include "chrome/browser/plugin_installer.h" +#include "app/resource_bundle.h" #include "base/string_util.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "webkit/default_plugin/default_plugin_shared.h" diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index 8a602f0..6fd6a46 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -7,6 +7,7 @@ #include #include +#include "app/resource_bundle.h" #include "base/gfx/native_widget_types.h" #include "base/string_util.h" #include "base/time.h" @@ -30,7 +31,6 @@ #include "chrome/common/notification_service.h" #include "chrome/common/notification_type.h" #include "chrome/common/render_messages.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/result_codes.h" #include "chrome/common/thumbnail_score.h" #include "chrome/common/url_constants.h" diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc index 9eb27d1..b143f2e 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc @@ -4,6 +4,7 @@ #include "chrome/browser/renderer_host/render_widget_host_view_win.h" +#include "app/resource_bundle.h" #include "base/command_line.h" #include "base/gfx/gdi_util.h" #include "base/gfx/rect.h" @@ -25,7 +26,6 @@ #include "chrome/common/native_web_keyboard_event.h" #include "chrome/common/plugin_messages.h" #include "chrome/common/render_messages.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" #include "chrome/views/focus/focus_util_win.h" // Included for views::kReflectedMessage - TODO(beng): move this to win_util.h! diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc index e1a21e3..63f9542 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc @@ -6,6 +6,7 @@ #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" +#include "app/resource_bundle.h" #include "base/histogram.h" #include "base/string_util.h" #include "chrome/browser/browser_process.h" @@ -19,7 +20,6 @@ #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/url_constants.h" #include "grit/browser_resources.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/ssl/ssl_blocking_page.cc b/chrome/browser/ssl/ssl_blocking_page.cc index 5d60cb8..f37317c 100644 --- a/chrome/browser/ssl/ssl_blocking_page.cc +++ b/chrome/browser/ssl/ssl_blocking_page.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ssl/ssl_blocking_page.h" +#include "app/resource_bundle.h" #include "base/histogram.h" #include "base/string_piece.h" #include "base/values.h" @@ -19,7 +20,6 @@ #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "grit/browser_resources.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/ssl/ssl_manager.cc b/chrome/browser/ssl/ssl_manager.cc index 7b54186..f5b0602 100644 --- a/chrome/browser/ssl/ssl_manager.cc +++ b/chrome/browser/ssl/ssl_manager.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ssl/ssl_manager.h" +#include "app/resource_bundle.h" #include "base/message_loop.h" #include "base/string_util.h" #include "chrome/browser/browser_process.h" @@ -23,7 +24,6 @@ #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "net/base/cert_status_flags.h" diff --git a/chrome/browser/ssl/ssl_policy.cc b/chrome/browser/ssl/ssl_policy.cc index e921d42..855c3f0 100644 --- a/chrome/browser/ssl/ssl_policy.cc +++ b/chrome/browser/ssl/ssl_policy.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ssl/ssl_policy.h" +#include "app/resource_bundle.h" #include "base/singleton.h" #include "base/string_piece.h" #include "base/string_util.h" @@ -17,7 +18,6 @@ #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/time_format.h" #include "chrome/common/url_constants.h" diff --git a/chrome/browser/tab_contents/navigation_controller.cc b/chrome/browser/tab_contents/navigation_controller.cc index 30dabe3..4b3e748 100644 --- a/chrome/browser/tab_contents/navigation_controller.cc +++ b/chrome/browser/tab_contents/navigation_controller.cc @@ -4,6 +4,7 @@ #include "chrome/browser/tab_contents/navigation_controller.h" +#include "app/resource_bundle.h" #include "base/file_util.h" #include "base/logging.h" #include "base/string_util.h" @@ -18,7 +19,6 @@ #include "chrome/common/navigation_types.h" #include "chrome/common/notification_service.h" #include "chrome/common/render_messages.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/url_constants.h" #include "webkit/glue/webkit_glue.h" diff --git a/chrome/browser/tab_contents/navigation_entry.cc b/chrome/browser/tab_contents/navigation_entry.cc index 7633ac6..874f9fc 100644 --- a/chrome/browser/tab_contents/navigation_entry.cc +++ b/chrome/browser/tab_contents/navigation_entry.cc @@ -4,12 +4,12 @@ #include "chrome/browser/tab_contents/navigation_entry.h" +#include "app/resource_bundle.h" #include "chrome/browser/tab_contents/navigation_controller.h" #include "chrome/common/gfx/text_elider.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "chrome/common/url_constants.h" -#include "chrome/common/resource_bundle.h" // Use this to get a new unique ID for a NavigationEntry during construction. // The returned ID is guaranteed to be nonzero (which is the "no ID" indicator). diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index 72ee5602..2dec5dc 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -4,6 +4,7 @@ #include "chrome/browser/tab_contents/tab_contents.h" +#include "app/resource_bundle.h" #include "base/file_version_info.h" #include "base/process_util.h" #include "base/string16.h" @@ -41,7 +42,6 @@ #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "chrome/common/render_messages.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/url_constants.h" //#include "grit/generated_resources.h" #include "grit/locale_settings.h" diff --git a/chrome/browser/task_manager.cc b/chrome/browser/task_manager.cc index 3c42090..4f96d2b 100644 --- a/chrome/browser/task_manager.cc +++ b/chrome/browser/task_manager.cc @@ -4,6 +4,7 @@ #include "chrome/browser/task_manager.h" +#include "app/resource_bundle.h" #include "base/process_util.h" #include "base/stats_table.h" #include "base/string_util.h" @@ -17,7 +18,6 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/accelerator.h" #include "chrome/views/background.h" #include "chrome/views/controls/button/native_button.h" diff --git a/chrome/browser/task_manager_resource_providers.cc b/chrome/browser/task_manager_resource_providers.cc index 7635896..39d4ccb 100644 --- a/chrome/browser/task_manager_resource_providers.cc +++ b/chrome/browser/task_manager_resource_providers.cc @@ -4,6 +4,7 @@ #include "chrome/browser/task_manager_resource_providers.h" +#include "app/resource_bundle.h" #include "base/basictypes.h" #include "base/file_version_info.h" #include "base/message_loop.h" @@ -19,7 +20,6 @@ #include "chrome/common/child_process_host.h" #include "chrome/common/l10n_util.h" #include "chrome/common/notification_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/stl_util-inl.h" #if defined(OS_WIN) #include "chrome/common/gfx/icon_util.h" diff --git a/chrome/browser/views/about_chrome_view.cc b/chrome/browser/views/about_chrome_view.cc index 131d9e0..ed79f59 100644 --- a/chrome/browser/views/about_chrome_view.cc +++ b/chrome/browser/views/about_chrome_view.cc @@ -6,6 +6,7 @@ #include +#include "app/resource_bundle.h" #include "base/file_version_info.h" #include "base/string_util.h" #include "base/win_util.h" @@ -17,7 +18,6 @@ #include "chrome/browser/views/restart_message_box.h" #include "chrome/browser/views/standard_layout.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/chrome_constants.h" #include "chrome/installer/util/install_util.h" #include "chrome/views/controls/text_field.h" diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc index 04bf2cd..2012a44 100644 --- a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc +++ b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc @@ -6,6 +6,7 @@ #include +#include "app/resource_bundle.h" #include "chrome/browser/autocomplete/autocomplete_edit_view_win.h" #include "chrome/browser/autocomplete/autocomplete_popup_model.h" #include "chrome/browser/views/autocomplete/autocomplete_popup_win.h" @@ -14,7 +15,6 @@ #include "chrome/common/gfx/insets.h" #include "chrome/common/gfx/path.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" #include "chrome/views/widget/widget.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/views/blocked_popup_container.cc b/chrome/browser/views/blocked_popup_container.cc index a5bcfbb0..37b42f3 100644 --- a/chrome/browser/views/blocked_popup_container.cc +++ b/chrome/browser/views/blocked_popup_container.cc @@ -12,6 +12,7 @@ #include +#include "app/resource_bundle.h" #include "base/string_util.h" #include "chrome/browser/extensions/extension_function_dispatcher.h" #include "chrome/browser/profile.h" @@ -21,7 +22,6 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/background.h" #include "chrome/views/controls/button/image_button.h" #include "chrome/views/controls/button/menu_button.h" diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc index 88f0fb5..cc56194 100644 --- a/chrome/browser/views/bookmark_bar_view.cc +++ b/chrome/browser/views/bookmark_bar_view.cc @@ -6,6 +6,7 @@ #include +#include "app/resource_bundle.h" #include "base/string_util.h" #include "base/base_drag_source.h" #include "chrome/browser/bookmarks/bookmark_context_menu.h" @@ -31,7 +32,6 @@ #include "chrome/common/page_transition_types.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" #include "chrome/views/controls/button/menu_button.h" #include "chrome/views/controls/menu/chrome_menu.h" diff --git a/chrome/browser/views/bookmark_bubble_view.cc b/chrome/browser/views/bookmark_bubble_view.cc index 9c38f12..86fe3ac 100644 --- a/chrome/browser/views/bookmark_bubble_view.cc +++ b/chrome/browser/views/bookmark_bubble_view.cc @@ -4,6 +4,7 @@ #include "chrome/browser/views/bookmark_bubble_view.h" +#include "app/resource_bundle.h" #include "chrome/app/chrome_dll_resource.h" #include "chrome/browser/bookmarks/bookmark_editor.h" #include "chrome/browser/bookmarks/bookmark_model.h" @@ -15,7 +16,6 @@ #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/l10n_util.h" #include "chrome/common/notification_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/controls/button/native_button.h" #include "chrome/views/controls/text_field.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/views/bookmark_menu_button.cc b/chrome/browser/views/bookmark_menu_button.cc index 7ee1d0c..4ac62e9 100644 --- a/chrome/browser/views/bookmark_menu_button.cc +++ b/chrome/browser/views/bookmark_menu_button.cc @@ -4,13 +4,13 @@ #include "chrome/browser/views/bookmark_menu_button.h" +#include "app/resource_bundle.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/browser.h" #include "chrome/browser/profile.h" #include "chrome/browser/view_ids.h" #include "chrome/common/os_exchange_data.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/widget/widget.h" #include "grit/theme_resources.h" diff --git a/chrome/browser/views/bookmark_table_view.cc b/chrome/browser/views/bookmark_table_view.cc index b080a92..cf115a4 100644 --- a/chrome/browser/views/bookmark_table_view.cc +++ b/chrome/browser/views/bookmark_table_view.cc @@ -4,6 +4,7 @@ #include "chrome/browser/views/bookmark_table_view.h" +#include "app/resource_bundle.h" #include "base/base_drag_source.h" #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/bookmarks/bookmark_model.h" @@ -15,7 +16,6 @@ #include "chrome/common/os_exchange_data.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/view_constants.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/views/constrained_window_impl.cc b/chrome/browser/views/constrained_window_impl.cc index e049630..5d5ae8f 100644 --- a/chrome/browser/views/constrained_window_impl.cc +++ b/chrome/browser/views/constrained_window_impl.cc @@ -4,6 +4,7 @@ #include "chrome/browser/views/constrained_window_impl.h" +#include "app/resource_bundle.h" #include "base/gfx/rect.h" #include "chrome/app/chrome_dll_resource.h" #include "chrome/browser/browser_process.h" @@ -23,7 +24,6 @@ #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" #include "chrome/views/controls/button/image_button.h" #include "chrome/views/controls/hwnd_view.h" diff --git a/chrome/browser/views/download_item_view.cc b/chrome/browser/views/download_item_view.cc index 9069c8d..3337c25 100644 --- a/chrome/browser/views/download_item_view.cc +++ b/chrome/browser/views/download_item_view.cc @@ -6,6 +6,7 @@ #include +#include "app/resource_bundle.h" #include "base/file_path.h" #include "base/string_util.h" #include "chrome/browser/browser_process.h" @@ -15,7 +16,6 @@ #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/text_elider.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" #include "chrome/views/controls/button/native_button.h" #include "chrome/views/controls/menu/menu.h" diff --git a/chrome/browser/views/download_shelf_view.cc b/chrome/browser/views/download_shelf_view.cc index b5045c9..490eb42 100644 --- a/chrome/browser/views/download_shelf_view.cc +++ b/chrome/browser/views/download_shelf_view.cc @@ -6,6 +6,7 @@ #include +#include "app/resource_bundle.h" #include "base/logging.h" #include "chrome/browser/download/download_item_model.h" #include "chrome/browser/download/download_manager.h" @@ -14,7 +15,6 @@ #include "chrome/browser/views/download_item_view.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/background.h" #include "chrome/views/controls/button/image_button.h" #include "chrome/views/controls/image_view.h" diff --git a/chrome/browser/views/download_started_animation.cc b/chrome/browser/views/download_started_animation.cc index d108d36..b6ec708 100644 --- a/chrome/browser/views/download_started_animation.cc +++ b/chrome/browser/views/download_started_animation.cc @@ -4,9 +4,9 @@ #include "chrome/browser/views/download_started_animation.h" +#include "app/resource_bundle.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/notification_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/widget/widget_win.h" #include "grit/theme_resources.h" diff --git a/chrome/browser/views/edit_keyword_controller.cc b/chrome/browser/views/edit_keyword_controller.cc index 8173849..98295c9 100644 --- a/chrome/browser/views/edit_keyword_controller.cc +++ b/chrome/browser/views/edit_keyword_controller.cc @@ -4,6 +4,7 @@ #include "chrome/browser/views/edit_keyword_controller.h" +#include "app/resource_bundle.h" #include "base/string_util.h" #include "chrome/browser/metrics/user_metrics.h" #include "chrome/browser/net/url_fixer_upper.h" @@ -13,7 +14,6 @@ #include "chrome/browser/views/keyword_editor_view.h" #include "chrome/browser/views/standard_layout.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/controls/label.h" #include "chrome/views/controls/image_view.h" #include "chrome/views/controls/table/table_view.h" diff --git a/chrome/browser/views/find_bar_view.cc b/chrome/browser/views/find_bar_view.cc index cecf4e8..4aaccee 100644 --- a/chrome/browser/views/find_bar_view.cc +++ b/chrome/browser/views/find_bar_view.cc @@ -6,6 +6,7 @@ #include +#include "app/resource_bundle.h" #include "base/string_util.h" #include "chrome/browser/find_bar_controller.h" #include "chrome/browser/tab_contents/tab_contents.h" @@ -13,7 +14,6 @@ #include "chrome/browser/view_ids.h" #include "chrome/common/l10n_util.h" #include "chrome/common/gfx/chrome_canvas.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/background.h" #include "chrome/views/controls/button/image_button.h" #include "chrome/views/controls/label.h" diff --git a/chrome/browser/views/first_run_bubble.cc b/chrome/browser/views/first_run_bubble.cc index 31c4432..b1a153a 100644 --- a/chrome/browser/views/first_run_bubble.cc +++ b/chrome/browser/views/first_run_bubble.cc @@ -4,6 +4,7 @@ #include "chrome/browser/views/first_run_bubble.h" +#include "app/resource_bundle.h" #include "base/win_util.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" @@ -13,7 +14,6 @@ #include "chrome/browser/search_engines/template_url_model.h" #include "chrome/browser/views/standard_layout.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/event.h" #include "chrome/views/controls/button/native_button.h" #include "chrome/views/controls/label.h" diff --git a/chrome/browser/views/first_run_customize_view.cc b/chrome/browser/views/first_run_customize_view.cc index 9b12d57..6b5aa77 100644 --- a/chrome/browser/views/first_run_customize_view.cc +++ b/chrome/browser/views/first_run_customize_view.cc @@ -4,12 +4,12 @@ #include "chrome/browser/views/first_run_customize_view.h" +#include "app/resource_bundle.h" #include "chrome/browser/importer/importer.h" #include "chrome/browser/first_run.h" #include "chrome/browser/metrics/user_metrics.h" #include "chrome/browser/views/standard_layout.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/controls/button/checkbox.h" #include "chrome/views/controls/combo_box.h" #include "chrome/views/controls/image_view.h" diff --git a/chrome/browser/views/first_run_view.cc b/chrome/browser/views/first_run_view.cc index 43f3384..bbfb4f9 100644 --- a/chrome/browser/views/first_run_view.cc +++ b/chrome/browser/views/first_run_view.cc @@ -4,13 +4,13 @@ #include "chrome/browser/views/first_run_view.h" +#include "app/resource_bundle.h" #include "chrome/browser/importer/importer.h" #include "chrome/browser/first_run.h" #include "chrome/browser/metrics/user_metrics.h" #include "chrome/browser/views/first_run_customize_view.h" #include "chrome/browser/views/standard_layout.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/controls/button/checkbox.h" #include "chrome/views/controls/image_view.h" #include "chrome/views/controls/label.h" diff --git a/chrome/browser/views/first_run_view_base.cc b/chrome/browser/views/first_run_view_base.cc index 08f30d3..d55832d 100644 --- a/chrome/browser/views/first_run_view_base.cc +++ b/chrome/browser/views/first_run_view_base.cc @@ -4,6 +4,7 @@ #include "chrome/browser/views/first_run_view_base.h" +#include "app/resource_bundle.h" #include "base/command_line.h" #include "base/path_service.h" #include "base/thread.h" @@ -17,7 +18,6 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/background.h" #include "chrome/views/controls/button/checkbox.h" #include "chrome/views/controls/image_view.h" diff --git a/chrome/browser/views/frame/browser_frame.cc b/chrome/browser/views/frame/browser_frame.cc index 235fedc..f8e0ed3 100644 --- a/chrome/browser/views/frame/browser_frame.cc +++ b/chrome/browser/views/frame/browser_frame.cc @@ -7,12 +7,12 @@ #include #include +#include "app/resource_bundle.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/views/frame/browser_root_view.h" #include "chrome/browser/views/frame/browser_view.h" #include "chrome/browser/views/frame/glass_browser_frame_view.h" #include "chrome/browser/views/frame/opaque_browser_frame_view.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" #include "chrome/views/window/window_delegate.h" #include "grit/theme_resources.h" diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 8581d43..5150aa9 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -4,6 +4,7 @@ #include "chrome/browser/views/frame/browser_view.h" +#include "app/resource_bundle.h" #include "base/command_line.h" #include "base/file_version_info.h" #include "base/time.h" @@ -51,7 +52,6 @@ #include "chrome/common/os_exchange_data.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" #include "chrome/views/controls/scrollbar/native_scroll_bar.h" #include "chrome/views/fill_layout.h" diff --git a/chrome/browser/views/frame/glass_browser_frame_view.cc b/chrome/browser/views/frame/glass_browser_frame_view.cc index 770245f..89438b3 100644 --- a/chrome/browser/views/frame/glass_browser_frame_view.cc +++ b/chrome/browser/views/frame/glass_browser_frame_view.cc @@ -4,10 +4,10 @@ #include "chrome/browser/views/frame/glass_browser_frame_view.h" +#include "app/resource_bundle.h" #include "chrome/browser/views/frame/browser_view.h" #include "chrome/browser/views/tabs/tab_strip.h" #include "chrome/common/gfx/chrome_canvas.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/window/client_view.h" #include "chrome/views/window/window_resources.h" #include "grit/theme_resources.h" diff --git a/chrome/browser/views/frame/opaque_browser_frame_view.cc b/chrome/browser/views/frame/opaque_browser_frame_view.cc index 567b615..8e4a7b6 100644 --- a/chrome/browser/views/frame/opaque_browser_frame_view.cc +++ b/chrome/browser/views/frame/opaque_browser_frame_view.cc @@ -4,6 +4,7 @@ #include "chrome/browser/views/frame/opaque_browser_frame_view.h" +#include "app/resource_bundle.h" #include "chrome/browser/views/frame/browser_frame.h" #include "chrome/browser/views/frame/browser_view.h" #include "chrome/browser/views/tabs/tab_strip.h" @@ -11,7 +12,6 @@ #include "chrome/common/gfx/chrome_font.h" #include "chrome/common/gfx/path.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" #include "chrome/views/controls/button/image_button.h" #include "chrome/views/widget/root_view.h" diff --git a/chrome/browser/views/fullscreen_exit_bubble.cc b/chrome/browser/views/fullscreen_exit_bubble.cc index 39ac7490..d1327cd 100644 --- a/chrome/browser/views/fullscreen_exit_bubble.cc +++ b/chrome/browser/views/fullscreen_exit_bubble.cc @@ -4,11 +4,11 @@ #include "chrome/browser/views/fullscreen_exit_bubble.h" +#include "app/resource_bundle.h" #include "chrome/app/chrome_dll_resource.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/l10n_util.h" #include "chrome/common/l10n_util_win.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/widget/root_view.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/views/hung_renderer_view.cc b/chrome/browser/views/hung_renderer_view.cc index c203893..9d37319 100644 --- a/chrome/browser/views/hung_renderer_view.cc +++ b/chrome/browser/views/hung_renderer_view.cc @@ -4,6 +4,7 @@ #include "chrome/browser/views/hung_renderer_view.h" +#include "app/resource_bundle.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/renderer_host/render_view_host.h" @@ -13,7 +14,6 @@ #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/path.h" #include "chrome/common/logging_chrome.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/result_codes.h" #include "chrome/views/grid_layout.h" #include "chrome/views/controls/button/native_button.h" diff --git a/chrome/browser/views/info_bubble.cc b/chrome/browser/views/info_bubble.cc index 2d3968a..633de1b 100644 --- a/chrome/browser/views/info_bubble.cc +++ b/chrome/browser/views/info_bubble.cc @@ -4,6 +4,7 @@ #include "chrome/browser/views/info_bubble.h" +#include "app/resource_bundle.h" #include "base/win_util.h" #include "chrome/browser/browser_window.h" #include "chrome/browser/views/frame/browser_view.h" @@ -11,7 +12,6 @@ #include "chrome/common/gfx/path.h" #include "chrome/common/notification_service.h" #include "chrome/common/notification_type.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" #include "chrome/views/widget/root_view.h" #include "chrome/views/window/window.h" diff --git a/chrome/browser/views/infobars/infobars.cc b/chrome/browser/views/infobars/infobars.cc index 3ea0421..fd61ba6 100644 --- a/chrome/browser/views/infobars/infobars.cc +++ b/chrome/browser/views/infobars/infobars.cc @@ -4,12 +4,12 @@ #include "chrome/browser/views/infobars/infobars.h" +#include "app/resource_bundle.h" #include "base/message_loop.h" #include "chrome/browser/views/event_utils.h" #include "chrome/browser/views/infobars/infobar_container.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/slide_animation.h" #include "chrome/views/background.h" #include "chrome/views/controls/button/image_button.h" diff --git a/chrome/browser/views/keyword_editor_view.cc b/chrome/browser/views/keyword_editor_view.cc index b972144..e707cb9 100644 --- a/chrome/browser/views/keyword_editor_view.cc +++ b/chrome/browser/views/keyword_editor_view.cc @@ -6,6 +6,7 @@ #include +#include "app/resource_bundle.h" #include "base/gfx/png_decoder.h" #include "base/string_util.h" #include "chrome/browser/history/history.h" @@ -18,7 +19,6 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/stl_util-inl.h" #include "chrome/views/background.h" #include "chrome/views/grid_layout.h" @@ -485,15 +485,15 @@ void KeywordEditorView::Init() { add_button_ = new views::NativeButton( this, l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_NEW_BUTTON)); add_button_->SetEnabled(url_model_->loaded()); - + edit_button_ = new views::NativeButton( this, l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_EDIT_BUTTON)); edit_button_->SetEnabled(false); - + remove_button_ = new views::NativeButton( this, l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_REMOVE_BUTTON)); remove_button_->SetEnabled(false); - + make_default_button_ = new views::NativeButton( this, l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_MAKE_DEFAULT_BUTTON)); @@ -563,7 +563,7 @@ void KeywordEditorView::OnDoubleClick() { void KeywordEditorView::ButtonPressed(views::Button* sender) { if (sender == add_button_) { - EditKeywordController* controller = + EditKeywordController* controller = new EditKeywordController(GetWidget()->GetNativeView(), NULL, this, profile_); controller->Show(); diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc index 727eebc..9ddeea3 100644 --- a/chrome/browser/views/location_bar_view.cc +++ b/chrome/browser/views/location_bar_view.cc @@ -4,6 +4,7 @@ #include "chrome/browser/views/location_bar_view.h" +#include "app/resource_bundle.h" #include "base/path_service.h" #include "base/string_util.h" #include "chrome/app/chrome_dll_resource.h" @@ -24,7 +25,6 @@ #include "chrome/browser/views/first_run_bubble.h" #include "chrome/browser/views/page_info_window.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/win_util.h" #include "chrome/views/background.h" diff --git a/chrome/browser/views/options/advanced_contents_view.cc b/chrome/browser/views/options/advanced_contents_view.cc index 3063339..52cdd16 100644 --- a/chrome/browser/views/options/advanced_contents_view.cc +++ b/chrome/browser/views/options/advanced_contents_view.cc @@ -12,6 +12,7 @@ #include #include +#include "app/resource_bundle.h" #include "base/file_util.h" #include "base/path_service.h" #include "base/gfx/native_theme.h" @@ -31,7 +32,6 @@ #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/pref_member.h" #include "chrome/common/pref_names.h" -#include "chrome/common/resource_bundle.h" #include "chrome/installer/util/google_update_settings.h" #include "chrome/views/background.h" #include "chrome/views/controls/button/checkbox.h" diff --git a/chrome/browser/views/options/content_page_view.cc b/chrome/browser/views/options/content_page_view.cc index 7263505..e0cc572 100644 --- a/chrome/browser/views/options/content_page_view.cc +++ b/chrome/browser/views/options/content_page_view.cc @@ -9,6 +9,7 @@ #include "chrome/browser/views/options/content_page_view.h" +#include "app/resource_bundle.h" #include "base/file_util.h" #include "base/gfx/native_theme.h" #include "chrome/browser/browser_process.h" @@ -21,7 +22,6 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/controls/button/radio_button.h" #include "chrome/views/controls/text_field.h" #include "chrome/views/grid_layout.h" diff --git a/chrome/browser/views/options/cookies_view.cc b/chrome/browser/views/options/cookies_view.cc index f5c0a68..6d66800 100644 --- a/chrome/browser/views/options/cookies_view.cc +++ b/chrome/browser/views/options/cookies_view.cc @@ -6,6 +6,7 @@ #include "chrome/browser/views/options/cookies_view.h" +#include "app/resource_bundle.h" #include "base/string_util.h" #include "base/time_format.h" #include "chrome/browser/profile.h" @@ -13,7 +14,6 @@ #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/color_utils.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" #include "chrome/views/border.h" #include "chrome/views/grid_layout.h" diff --git a/chrome/browser/views/options/fonts_languages_window_view.cc b/chrome/browser/views/options/fonts_languages_window_view.cc index fd8ef61..36fbaf2 100644 --- a/chrome/browser/views/options/fonts_languages_window_view.cc +++ b/chrome/browser/views/options/fonts_languages_window_view.cc @@ -4,6 +4,7 @@ #include "chrome/browser/views/options/fonts_languages_window_view.h" +#include "app/resource_bundle.h" #include "chrome/browser/profile.h" #include "chrome/browser/views/options/fonts_page_view.h" #include "chrome/browser/views/options/languages_page_view.h" @@ -11,7 +12,6 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/window/window.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/views/options/fonts_page_view.cc b/chrome/browser/views/options/fonts_page_view.cc index c787704..f7be657 100644 --- a/chrome/browser/views/options/fonts_page_view.cc +++ b/chrome/browser/views/options/fonts_page_view.cc @@ -1,6 +1,9 @@ // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. + +#include "chrome/browser/views/options/fonts_page_view.h" + #include #include #include @@ -8,8 +11,7 @@ #include -#include "chrome/browser/views/options/fonts_page_view.h" - +#include "app/resource_bundle.h" #include "base/file_util.h" #include "base/gfx/native_theme.h" #include "base/string_util.h" @@ -22,7 +24,6 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/controls/button/native_button.h" #include "chrome/views/controls/text_field.h" #include "chrome/views/grid_layout.h" diff --git a/chrome/browser/views/options/general_page_view.cc b/chrome/browser/views/options/general_page_view.cc index 4fd0801..229f93a 100644 --- a/chrome/browser/views/options/general_page_view.cc +++ b/chrome/browser/views/options/general_page_view.cc @@ -4,6 +4,7 @@ #include "chrome/browser/views/options/general_page_view.h" +#include "app/resource_bundle.h" #include "base/gfx/png_decoder.h" #include "base/message_loop.h" #include "base/string_util.h" @@ -27,7 +28,6 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/url_constants.h" #include "chrome/views/controls/button/radio_button.h" #include "chrome/views/controls/label.h" diff --git a/chrome/browser/views/options/languages_page_view.cc b/chrome/browser/views/options/languages_page_view.cc index e8d968d..42e5b89 100644 --- a/chrome/browser/views/options/languages_page_view.cc +++ b/chrome/browser/views/options/languages_page_view.cc @@ -8,6 +8,7 @@ #include "chrome/browser/views/options/languages_page_view.h" +#include "app/resource_bundle.h" #include "base/file_util.h" #include "base/string_util.h" #include "base/gfx/native_theme.h" @@ -23,7 +24,6 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/controls/button/radio_button.h" #include "chrome/views/controls/combo_box.h" #include "chrome/views/controls/tabbed_pane.h" diff --git a/chrome/browser/views/options/options_group_view.cc b/chrome/browser/views/options/options_group_view.cc index c666f2a..2302eec 100644 --- a/chrome/browser/views/options/options_group_view.cc +++ b/chrome/browser/views/options/options_group_view.cc @@ -7,12 +7,12 @@ #include "chrome/browser/views/options/options_group_view.h" +#include "app/resource_bundle.h" #include "base/gfx/native_theme.h" #include "chrome/browser/views/standard_layout.h" #include "chrome/common/gfx/chrome_font.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/grid_layout.h" #include "chrome/views/controls/label.h" #include "chrome/views/controls/separator.h" diff --git a/chrome/browser/views/options/options_window_view.cc b/chrome/browser/views/options/options_window_view.cc index d163640..8b40893 100644 --- a/chrome/browser/views/options/options_window_view.cc +++ b/chrome/browser/views/options/options_window_view.cc @@ -4,6 +4,7 @@ #include "chrome/browser/options_window.h" +#include "app/resource_bundle.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profile.h" #include "chrome/browser/views/options/advanced_page_view.h" @@ -13,7 +14,6 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #ifdef CHROME_PERSONALIZATION #include "chrome/personalization/personalization.h" #include "chrome/personalization/views/user_data_page_view.h" diff --git a/chrome/browser/views/page_info_window.cc b/chrome/browser/views/page_info_window.cc index 5fa345e..f1bd9e4 100644 --- a/chrome/browser/views/page_info_window.cc +++ b/chrome/browser/views/page_info_window.cc @@ -7,6 +7,7 @@ #include #pragma comment(lib, "cryptui.lib") +#include "app/resource_bundle.h" #include "base/string_util.h" #include "base/time_format.h" #include "chrome/browser/browser_process.h" @@ -18,7 +19,6 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" #include "chrome/views/background.h" #include "chrome/views/grid_layout.h" diff --git a/chrome/browser/views/sad_tab_view.cc b/chrome/browser/views/sad_tab_view.cc index 509f951..0ed2454 100644 --- a/chrome/browser/views/sad_tab_view.cc +++ b/chrome/browser/views/sad_tab_view.cc @@ -4,10 +4,10 @@ #include "chrome/browser/views/sad_tab_view.h" +#include "app/resource_bundle.h" #include "base/gfx/size.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "skia/ext/skia_utils.h" diff --git a/chrome/browser/views/shelf_item_dialog.cc b/chrome/browser/views/shelf_item_dialog.cc index bb05c44..a19d6c7 100644 --- a/chrome/browser/views/shelf_item_dialog.cc +++ b/chrome/browser/views/shelf_item_dialog.cc @@ -4,6 +4,7 @@ #include "chrome/browser/views/shelf_item_dialog.h" +#include "app/resource_bundle.h" #include "base/gfx/png_decoder.h" #include "base/string_util.h" #include "chrome/browser/net/url_fixer_upper.h" @@ -14,7 +15,6 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/stl_util-inl.h" #include "chrome/views/background.h" #include "chrome/views/controls/label.h" diff --git a/chrome/browser/views/star_toggle.cc b/chrome/browser/views/star_toggle.cc index 83239e6..d350972 100644 --- a/chrome/browser/views/star_toggle.cc +++ b/chrome/browser/views/star_toggle.cc @@ -4,9 +4,9 @@ #include "chrome/browser/views/star_toggle.h" +#include "app/resource_bundle.h" #include "chrome/app/chrome_dll_resource.h" #include "chrome/common/gfx/chrome_canvas.h" -#include "chrome/common/resource_bundle.h" #include "grit/theme_resources.h" StarToggle::StarToggle(Delegate* delegate) diff --git a/chrome/browser/views/status_bubble_views.cc b/chrome/browser/views/status_bubble_views.cc index c657356..2426bf1 100644 --- a/chrome/browser/views/status_bubble_views.cc +++ b/chrome/browser/views/status_bubble_views.cc @@ -6,13 +6,13 @@ #include +#include "app/resource_bundle.h" #include "base/string_util.h" #include "chrome/common/animation.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/text_elider.h" #include "chrome/common/l10n_util.h" #include "chrome/common/l10n_util_win.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/controls/label.h" #include "chrome/views/widget/root_view.h" #include "chrome/views/widget/widget_win.h" @@ -508,7 +508,7 @@ void StatusBubbleViews::SetURL(const GURL& url, const std::wstring& languages) { // Set Elided Text corresponding to the GURL object. RECT parent_rect; ::GetWindowRect(popup_->GetNativeView(), &parent_rect); - int text_width = static_cast(parent_rect.right - parent_rect.left - + int text_width = static_cast(parent_rect.right - parent_rect.left - (kShadowThickness * 2) - kTextPositionX - kTextHorizPadding - 1); url_text_ = gfx::ElideUrl(url, view_->Label::GetFont(), text_width, languages); diff --git a/chrome/browser/views/tab_icon_view.cc b/chrome/browser/views/tab_icon_view.cc index e9da07e..43afd4f 100644 --- a/chrome/browser/views/tab_icon_view.cc +++ b/chrome/browser/views/tab_icon_view.cc @@ -7,6 +7,7 @@ #include #include +#include "app/resource_bundle.h" #include "base/file_util.h" #include "base/path_service.h" #include "chrome/app/chrome_dll_resource.h" @@ -14,7 +15,6 @@ #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/favicon_size.h" #include "chrome/common/gfx/icon_util.h" -#include "chrome/common/resource_bundle.h" #include "grit/theme_resources.h" static bool g_initialized = false; diff --git a/chrome/browser/views/tabs/dragged_tab_controller.cc b/chrome/browser/views/tabs/dragged_tab_controller.cc index 83bf266..8df9a38 100644 --- a/chrome/browser/views/tabs/dragged_tab_controller.cc +++ b/chrome/browser/views/tabs/dragged_tab_controller.cc @@ -7,6 +7,7 @@ #include #include +#include "app/resource_bundle.h" #include "chrome/browser/browser_window.h" #include "chrome/browser/extensions/extension_function_dispatcher.h" #include "chrome/browser/tab_contents/tab_contents.h" @@ -20,7 +21,6 @@ #include "chrome/common/animation.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/notification_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/event.h" #include "chrome/views/widget/root_view.h" #include "grit/theme_resources.h" diff --git a/chrome/browser/views/tabs/tab.cc b/chrome/browser/views/tabs/tab.cc index 37f8db1..e79b77c 100644 --- a/chrome/browser/views/tabs/tab.cc +++ b/chrome/browser/views/tabs/tab.cc @@ -4,11 +4,11 @@ #include "chrome/browser/views/tabs/tab.h" +#include "app/resource_bundle.h" #include "base/gfx/size.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/path.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/controls/menu/chrome_menu.h" #include "chrome/views/widget/tooltip_manager.h" #include "chrome/views/widget/widget.h" diff --git a/chrome/browser/views/tabs/tab_renderer.cc b/chrome/browser/views/tabs/tab_renderer.cc index 7f62be5..e9608bd 100644 --- a/chrome/browser/views/tabs/tab_renderer.cc +++ b/chrome/browser/views/tabs/tab_renderer.cc @@ -6,6 +6,7 @@ #include "chrome/browser/views/tabs/tab_renderer.h" +#include "app/resource_bundle.h" #include "chrome/browser/browser.h" #include "chrome/browser/profile.h" #include "chrome/browser/tab_contents/tab_contents.h" @@ -13,7 +14,6 @@ #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/chrome_font.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" #include "chrome/views/widget/widget.h" #include "chrome/views/window/non_client_view.h" diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc index 5e8cbdc..1218ed8 100644 --- a/chrome/browser/views/tabs/tab_strip.cc +++ b/chrome/browser/views/tabs/tab_strip.cc @@ -4,6 +4,7 @@ #include "chrome/browser/views/tabs/tab_strip.h" +#include "app/resource_bundle.h" #include "base/gfx/size.h" #include "chrome/browser/metrics/user_metrics.h" #include "chrome/browser/profile.h" @@ -19,7 +20,6 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/os_exchange_data.h" #include "chrome/common/pref_names.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/slide_animation.h" #include "chrome/common/stl_util-inl.h" #include "chrome/common/win_util.h" diff --git a/chrome/browser/views/toolbar_star_toggle.cc b/chrome/browser/views/toolbar_star_toggle.cc index b76f442..330bb6c 100644 --- a/chrome/browser/views/toolbar_star_toggle.cc +++ b/chrome/browser/views/toolbar_star_toggle.cc @@ -4,11 +4,11 @@ #include "chrome/browser/views/toolbar_star_toggle.h" +#include "app/resource_bundle.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/browser.h" #include "chrome/browser/views/bookmark_bubble_view.h" #include "chrome/browser/views/toolbar_view.h" -#include "chrome/common/resource_bundle.h" #include "googleurl/src/gurl.h" #include "grit/theme_resources.h" diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index 81ea797..ef6d5e2 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -6,6 +6,7 @@ #include +#include "app/resource_bundle.h" #include "base/command_line.h" #include "base/logging.h" #include "base/path_service.h" @@ -37,7 +38,6 @@ #include "chrome/common/os_exchange_data.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" #ifdef CHROME_PERSONALIZATION #include "chrome/personalization/personalization.h" diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index e52bbce..c2afd27 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -108,6 +108,35 @@ }, }, { + 'target_name': 'app_base', + 'type': '<(library)', + 'msvs_guid': '4631946D-7D5F-44BD-A5A8-504C0A7033BE', + 'dependencies': [ + '../base/base.gyp:base', + '../base/base.gyp:base_gfx', + '../net/net.gyp:net', + '../skia/skia.gyp:skia', + '../third_party/icu38/icu38.gyp:icui18n', + '../third_party/icu38/icu38.gyp:icuuc', + ], + 'include_dirs': [ + '..', + ], + 'sources': [ + # All .cc, .h, and .mm files under app/ except for tests. + '../app/resource_bundle.cc', + '../app/resource_bundle.h', + '../app/resource_bundle_win.cc', + '../app/resource_bundle_linux.cc', + '../app/resource_bundle_mac.mm', + ], + 'direct_dependent_settings': { + 'include_dirs': [ + '..', + ], + }, + }, + { # theme_resources also generates a .cc file, so it can't use the rules above. 'target_name': 'theme_resources', 'type': 'none', @@ -145,6 +174,7 @@ 'target_name': 'common', 'type': '<(library)', 'dependencies': [ + 'app_base', 'chrome_resources', 'chrome_strings', '../base/base.gyp:base', @@ -331,11 +361,6 @@ 'common/ref_counted_util.h', 'common/render_messages.h', 'common/render_messages_internal.h', - 'common/resource_bundle.cc', - 'common/resource_bundle.h', - 'common/resource_bundle_linux.cc', - 'common/resource_bundle_mac.mm', - 'common/resource_bundle_win.cc', 'common/resource_dispatcher.cc', 'common/resource_dispatcher.h', 'common/result_codes.h', @@ -388,6 +413,9 @@ '..', ], }, + 'export_dependent_settings': [ + 'app_base', + ], 'conditions': [ ['OS=="linux"', { 'dependencies': [ diff --git a/chrome/chrome.sln b/chrome/chrome.sln index cd77cb3..21166bfd 100644 --- a/chrome/chrome.sln +++ b/chrome/chrome.sln @@ -148,6 +148,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "chrome_dll", "app\chrome_dl {238CE175-76CE-4A25-A676-69D115885601} = {238CE175-76CE-4A25-A676-69D115885601} {2A70CBF0-847E-4E3A-B926-542A656DC7FE} = {2A70CBF0-847E-4E3A-B926-542A656DC7FE} {326E9795-E760-410A-B69A-3F79DB3F5243} = {326E9795-E760-410A-B69A-3F79DB3F5243} + {4631946D-7D5F-44BD-A5A8-504C0A7033BE} = {4631946D-7D5F-44BD-A5A8-504C0A7033BE} {49909552-0B0C-4C14-8CF6-DB8A2ADE0934} = {49909552-0B0C-4C14-8CF6-DB8A2ADE0934} {5597AD47-3494-4750-A235-4F9C2F864700} = {5597AD47-3494-4750-A235-4F9C2F864700} {57823D8C-A317-4713-9125-2C91FDFD12D6} = {57823D8C-A317-4713-9125-2C91FDFD12D6} @@ -244,6 +245,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "perf_tests", "test\perf\per {238CE175-76CE-4A25-A676-69D115885601} = {238CE175-76CE-4A25-A676-69D115885601} {2A70CBF0-847E-4E3A-B926-542A656DC7FE} = {2A70CBF0-847E-4E3A-B926-542A656DC7FE} {326E9795-E760-410A-B69A-3F79DB3F5243} = {326E9795-E760-410A-B69A-3F79DB3F5243} + {4631946D-7D5F-44BD-A5A8-504C0A7033BE} = {4631946D-7D5F-44BD-A5A8-504C0A7033BE} {49909552-0B0C-4C14-8CF6-DB8A2ADE0934} = {49909552-0B0C-4C14-8CF6-DB8A2ADE0934} {5597AD47-3494-4750-A235-4F9C2F864700} = {5597AD47-3494-4750-A235-4F9C2F864700} {57823D8C-A317-4713-9125-2C91FDFD12D6} = {57823D8C-A317-4713-9125-2C91FDFD12D6} @@ -284,6 +286,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unit_tests", "test\unit\uni {238CE175-76CE-4A25-A676-69D115885601} = {238CE175-76CE-4A25-A676-69D115885601} {2A70CBF0-847E-4E3A-B926-542A656DC7FE} = {2A70CBF0-847E-4E3A-B926-542A656DC7FE} {326E9795-E760-410A-B69A-3F79DB3F5243} = {326E9795-E760-410A-B69A-3F79DB3F5243} + {4631946D-7D5F-44BD-A5A8-504C0A7033BE} = {4631946D-7D5F-44BD-A5A8-504C0A7033BE} {49909552-0B0C-4C14-8CF6-DB8A2ADE0934} = {49909552-0B0C-4C14-8CF6-DB8A2ADE0934} {5597AD47-3494-4750-A235-4F9C2F864700} = {5597AD47-3494-4750-A235-4F9C2F864700} {57823D8C-A317-4713-9125-2C91FDFD12D6} = {57823D8C-A317-4713-9125-2C91FDFD12D6} @@ -329,6 +332,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "page_cycler_tests", "test\p {1556EF78-C7E6-43C8-951F-F6B43AC0DD12} = {1556EF78-C7E6-43C8-951F-F6B43AC0DD12} {1832A374-8A74-4F9E-B536-69A699B3E165} = {1832A374-8A74-4F9E-B536-69A699B3E165} {326E9795-E760-410A-B69A-3F79DB3F5243} = {326E9795-E760-410A-B69A-3F79DB3F5243} + {4631946D-7D5F-44BD-A5A8-504C0A7033BE} = {4631946D-7D5F-44BD-A5A8-504C0A7033BE} {5BF908A7-68FB-4A4B-99E3-8C749F1FE4EA} = {5BF908A7-68FB-4A4B-99E3-8C749F1FE4EA} {7100F41F-868D-4E99-80A2-AF8E6574749D} = {7100F41F-868D-4E99-80A2-AF8E6574749D} {7B219FAA-E360-43C8-B341-804A94EEFFAC} = {7B219FAA-E360-43C8-B341-804A94EEFFAC} @@ -348,6 +352,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reliability_tests", "test\r {1556EF78-C7E6-43C8-951F-F6B43AC0DD12} = {1556EF78-C7E6-43C8-951F-F6B43AC0DD12} {1832A374-8A74-4F9E-B536-69A699B3E165} = {1832A374-8A74-4F9E-B536-69A699B3E165} {326E9795-E760-410A-B69A-3F79DB3F5243} = {326E9795-E760-410A-B69A-3F79DB3F5243} + {4631946D-7D5F-44BD-A5A8-504C0A7033BE} = {4631946D-7D5F-44BD-A5A8-504C0A7033BE} {5BF908A7-68FB-4A4B-99E3-8C749F1FE4EA} = {5BF908A7-68FB-4A4B-99E3-8C749F1FE4EA} {7100F41F-868D-4E99-80A2-AF8E6574749D} = {7100F41F-868D-4E99-80A2-AF8E6574749D} {7B219FAA-E360-43C8-B341-804A94EEFFAC} = {7B219FAA-E360-43C8-B341-804A94EEFFAC} @@ -386,6 +391,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "startup_tests", "test\start {1556EF78-C7E6-43C8-951F-F6B43AC0DD12} = {1556EF78-C7E6-43C8-951F-F6B43AC0DD12} {1832A374-8A74-4F9E-B536-69A699B3E165} = {1832A374-8A74-4F9E-B536-69A699B3E165} {326E9795-E760-410A-B69A-3F79DB3F5243} = {326E9795-E760-410A-B69A-3F79DB3F5243} + {4631946D-7D5F-44BD-A5A8-504C0A7033BE} = {4631946D-7D5F-44BD-A5A8-504C0A7033BE} {5BF908A7-68FB-4A4B-99E3-8C749F1FE4EA} = {5BF908A7-68FB-4A4B-99E3-8C749F1FE4EA} {7100F41F-868D-4E99-80A2-AF8E6574749D} = {7100F41F-868D-4E99-80A2-AF8E6574749D} {7B219FAA-E360-43C8-B341-804A94EEFFAC} = {7B219FAA-E360-43C8-B341-804A94EEFFAC} @@ -408,6 +414,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ui_tests", "test\ui\ui_test {21E22961-22BF-4493-BD3A-868F93DA5179} = {21E22961-22BF-4493-BD3A-868F93DA5179} {2A70CBF0-847E-4E3A-B926-542A656DC7FE} = {2A70CBF0-847E-4E3A-B926-542A656DC7FE} {326E9795-E760-410A-B69A-3F79DB3F5243} = {326E9795-E760-410A-B69A-3F79DB3F5243} + {4631946D-7D5F-44BD-A5A8-504C0A7033BE} = {4631946D-7D5F-44BD-A5A8-504C0A7033BE} {5BF908A7-68FB-4A4B-99E3-8C749F1FE4EA} = {5BF908A7-68FB-4A4B-99E3-8C749F1FE4EA} {7100F41F-868D-4E99-80A2-AF8E6574749D} = {7100F41F-868D-4E99-80A2-AF8E6574749D} {7B219FAA-E360-43C8-B341-804A94EEFFAC} = {7B219FAA-E360-43C8-B341-804A94EEFFAC} @@ -444,6 +451,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "generate_profile", "tools\p {238CE175-76CE-4A25-A676-69D115885601} = {238CE175-76CE-4A25-A676-69D115885601} {2A70CBF0-847E-4E3A-B926-542A656DC7FE} = {2A70CBF0-847E-4E3A-B926-542A656DC7FE} {326E9795-E760-410A-B69A-3F79DB3F5243} = {326E9795-E760-410A-B69A-3F79DB3F5243} + {4631946D-7D5F-44BD-A5A8-504C0A7033BE} = {4631946D-7D5F-44BD-A5A8-504C0A7033BE} {49909552-0B0C-4C14-8CF6-DB8A2ADE0934} = {49909552-0B0C-4C14-8CF6-DB8A2ADE0934} {57823D8C-A317-4713-9125-2C91FDFD12D6} = {57823D8C-A317-4713-9125-2C91FDFD12D6} {5916D37D-8C97-424F-A904-74E52594C2D6} = {5916D37D-8C97-424F-A904-74E52594C2D6} @@ -637,6 +645,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "plugin_tests", "test\plugin {1832A374-8A74-4F9E-B536-69A699B3E165} = {1832A374-8A74-4F9E-B536-69A699B3E165} {326E9795-E760-410A-B69A-3F79DB3F5243} = {326E9795-E760-410A-B69A-3F79DB3F5243} {414D4D24-5D65-498B-A33F-3A29AD3CDEDC} = {414D4D24-5D65-498B-A33F-3A29AD3CDEDC} + {4631946D-7D5F-44BD-A5A8-504C0A7033BE} = {4631946D-7D5F-44BD-A5A8-504C0A7033BE} {5916D37D-8C97-424F-A904-74E52594C2D6} = {5916D37D-8C97-424F-A904-74E52594C2D6} {5BF908A7-68FB-4A4B-99E3-8C749F1FE4EA} = {5BF908A7-68FB-4A4B-99E3-8C749F1FE4EA} {7100F41F-868D-4E99-80A2-AF8E6574749D} = {7100F41F-868D-4E99-80A2-AF8E6574749D} @@ -665,6 +674,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "interactive_ui_tests", "tes {238CE175-76CE-4A25-A676-69D115885601} = {238CE175-76CE-4A25-A676-69D115885601} {2A70CBF0-847E-4E3A-B926-542A656DC7FE} = {2A70CBF0-847E-4E3A-B926-542A656DC7FE} {326E9795-E760-410A-B69A-3F79DB3F5243} = {326E9795-E760-410A-B69A-3F79DB3F5243} + {4631946D-7D5F-44BD-A5A8-504C0A7033BE} = {4631946D-7D5F-44BD-A5A8-504C0A7033BE} {49909552-0B0C-4C14-8CF6-DB8A2ADE0934} = {49909552-0B0C-4C14-8CF6-DB8A2ADE0934} {5597AD47-3494-4750-A235-4F9C2F864700} = {5597AD47-3494-4750-A235-4F9C2F864700} {57823D8C-A317-4713-9125-2C91FDFD12D6} = {57823D8C-A317-4713-9125-2C91FDFD12D6} @@ -836,6 +846,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "automated_ui_tests", "test\ {1556EF78-C7E6-43C8-951F-F6B43AC0DD12} = {1556EF78-C7E6-43C8-951F-F6B43AC0DD12} {1832A374-8A74-4F9E-B536-69A699B3E165} = {1832A374-8A74-4F9E-B536-69A699B3E165} {326E9795-E760-410A-B69A-3F79DB3F5243} = {326E9795-E760-410A-B69A-3F79DB3F5243} + {4631946D-7D5F-44BD-A5A8-504C0A7033BE} = {4631946D-7D5F-44BD-A5A8-504C0A7033BE} {5BF908A7-68FB-4A4B-99E3-8C749F1FE4EA} = {5BF908A7-68FB-4A4B-99E3-8C749F1FE4EA} {7100F41F-868D-4E99-80A2-AF8E6574749D} = {7100F41F-868D-4E99-80A2-AF8E6574749D} {7B219FAA-E360-43C8-B341-804A94EEFFAC} = {7B219FAA-E360-43C8-B341-804A94EEFFAC} @@ -1183,6 +1194,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tab_switching_test", "test\ {1556EF78-C7E6-43C8-951F-F6B43AC0DD12} = {1556EF78-C7E6-43C8-951F-F6B43AC0DD12} {1832A374-8A74-4F9E-B536-69A699B3E165} = {1832A374-8A74-4F9E-B536-69A699B3E165} {326E9795-E760-410A-B69A-3F79DB3F5243} = {326E9795-E760-410A-B69A-3F79DB3F5243} + {4631946D-7D5F-44BD-A5A8-504C0A7033BE} = {4631946D-7D5F-44BD-A5A8-504C0A7033BE} {5BF908A7-68FB-4A4B-99E3-8C749F1FE4EA} = {5BF908A7-68FB-4A4B-99E3-8C749F1FE4EA} {7100F41F-868D-4E99-80A2-AF8E6574749D} = {7100F41F-868D-4E99-80A2-AF8E6574749D} {76235B67-1C27-4627-8A33-4B2E1EF93EDE} = {76235B67-1C27-4627-8A33-4B2E1EF93EDE} @@ -1220,6 +1232,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "memory_test", "test\memory_ {1556EF78-C7E6-43C8-951F-F6B43AC0DD12} = {1556EF78-C7E6-43C8-951F-F6B43AC0DD12} {1832A374-8A74-4F9E-B536-69A699B3E165} = {1832A374-8A74-4F9E-B536-69A699B3E165} {326E9795-E760-410A-B69A-3F79DB3F5243} = {326E9795-E760-410A-B69A-3F79DB3F5243} + {4631946D-7D5F-44BD-A5A8-504C0A7033BE} = {4631946D-7D5F-44BD-A5A8-504C0A7033BE} {5BF908A7-68FB-4A4B-99E3-8C749F1FE4EA} = {5BF908A7-68FB-4A4B-99E3-8C749F1FE4EA} {7100F41F-868D-4E99-80A2-AF8E6574749D} = {7100F41F-868D-4E99-80A2-AF8E6574749D} {8423AF0D-4B88-4EBF-94E1-E4D00D00E21C} = {8423AF0D-4B88-4EBF-94E1-E4D00D00E21C} @@ -1382,6 +1395,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "url_fetch_test", "test\url_ {21E22961-22BF-4493-BD3A-868F93DA5179} = {21E22961-22BF-4493-BD3A-868F93DA5179} {2A70CBF0-847E-4E3A-B926-542A656DC7FE} = {2A70CBF0-847E-4E3A-B926-542A656DC7FE} {326E9795-E760-410A-B69A-3F79DB3F5243} = {326E9795-E760-410A-B69A-3F79DB3F5243} + {4631946D-7D5F-44BD-A5A8-504C0A7033BE} = {4631946D-7D5F-44BD-A5A8-504C0A7033BE} {5BF908A7-68FB-4A4B-99E3-8C749F1FE4EA} = {5BF908A7-68FB-4A4B-99E3-8C749F1FE4EA} {7100F41F-868D-4E99-80A2-AF8E6574749D} = {7100F41F-868D-4E99-80A2-AF8E6574749D} {7B219FAA-E360-43C8-B341-804A94EEFFAC} = {7B219FAA-E360-43C8-B341-804A94EEFFAC} @@ -1446,6 +1460,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "browser_tests_dll", "test\b {238CE175-76CE-4A25-A676-69D115885601} = {238CE175-76CE-4A25-A676-69D115885601} {2A70CBF0-847E-4E3A-B926-542A656DC7FE} = {2A70CBF0-847E-4E3A-B926-542A656DC7FE} {326E9795-E760-410A-B69A-3F79DB3F5243} = {326E9795-E760-410A-B69A-3F79DB3F5243} + {4631946D-7D5F-44BD-A5A8-504C0A7033BE} = {4631946D-7D5F-44BD-A5A8-504C0A7033BE} {49909552-0B0C-4C14-8CF6-DB8A2ADE0934} = {49909552-0B0C-4C14-8CF6-DB8A2ADE0934} {5597AD47-3494-4750-A235-4F9C2F864700} = {5597AD47-3494-4750-A235-4F9C2F864700} {57823D8C-A317-4713-9125-2C91FDFD12D6} = {57823D8C-A317-4713-9125-2C91FDFD12D6} @@ -1491,6 +1506,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "browser_tests_launcher", "t EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tcmalloc", "..\third_party\tcmalloc\tcmalloc.vcproj", "{C564F145-9172-42C3-BFCB-60FDEA124321}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "app", "..\app\app.vcproj", "{4631946D-7D5F-44BD-A5A8-504C0A7033BE}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Mixed Platforms = Debug|Mixed Platforms @@ -1836,6 +1853,14 @@ Global {4539AFB3-B8DC-47F3-A491-6DAC8FD26657}.Release|Mixed Platforms.Build.0 = Release|Win32 {4539AFB3-B8DC-47F3-A491-6DAC8FD26657}.Release|Win32.ActiveCfg = Release|Win32 {4539AFB3-B8DC-47F3-A491-6DAC8FD26657}.Release|Win32.Build.0 = Release|Win32 + {4631946D-7D5F-44BD-A5A8-504C0A7033BE}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {4631946D-7D5F-44BD-A5A8-504C0A7033BE}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {4631946D-7D5F-44BD-A5A8-504C0A7033BE}.Debug|Win32.ActiveCfg = Debug|Win32 + {4631946D-7D5F-44BD-A5A8-504C0A7033BE}.Debug|Win32.Build.0 = Debug|Win32 + {4631946D-7D5F-44BD-A5A8-504C0A7033BE}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {4631946D-7D5F-44BD-A5A8-504C0A7033BE}.Release|Mixed Platforms.Build.0 = Release|Win32 + {4631946D-7D5F-44BD-A5A8-504C0A7033BE}.Release|Win32.ActiveCfg = Release|Win32 + {4631946D-7D5F-44BD-A5A8-504C0A7033BE}.Release|Win32.Build.0 = Release|Win32 {49909552-0B0C-4C14-8CF6-DB8A2ADE0934}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {49909552-0B0C-4C14-8CF6-DB8A2ADE0934}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {49909552-0B0C-4C14-8CF6-DB8A2ADE0934}.Debug|Win32.ActiveCfg = Debug|Win32 @@ -2885,6 +2910,7 @@ Global {41735CD9-3E35-47F7-9FD1-4A9950B6B131} = {846901FD-A619-4BD5-A303-38174730CDD6} {42ECD5EC-722F-41DE-B6B8-83764C8016DF} = {846901FD-A619-4BD5-A303-38174730CDD6} {4539AFB3-B8DC-47F3-A491-6DAC8FD26657} = {846901FD-A619-4BD5-A303-38174730CDD6} + {4631946D-7D5F-44BD-A5A8-504C0A7033BE} = {EF78C1F9-AA17-4CA5-B6CB-39B37A73A3DA} {49909552-0B0C-4C14-8CF6-DB8A2ADE0934} = {1088577A-0C49-4DE0-85CD-B68AD0BE55AA} {4B60E8B8-416F-40B2-8A54-F75970A21992} = {2325D8C4-8EF5-42AC-8900-492225750DE4} {4B6E199A-034A-49BD-AB93-458DD37E45B1} = {1174D37F-6ABB-45DA-81B3-C631281273B7} diff --git a/chrome/common/common.vcproj b/chrome/common/common.vcproj index fdf0ed3..be7638f 100644 --- a/chrome/common/common.vcproj +++ b/chrome/common/common.vcproj @@ -714,11 +714,11 @@ > - - - - - - diff --git a/chrome/common/jstemplate_builder.cc b/chrome/common/jstemplate_builder.cc index f1cbb0f..96e79b4 100644 --- a/chrome/common/jstemplate_builder.cc +++ b/chrome/common/jstemplate_builder.cc @@ -7,10 +7,10 @@ #include "chrome/common/jstemplate_builder.h" +#include "app/resource_bundle.h" #include "base/logging.h" #include "base/string_util.h" #include "chrome/common/json_value_serializer.h" -#include "chrome/common/resource_bundle.h" #include "grit/common_resources.h" diff --git a/chrome/common/l10n_util.cc b/chrome/common/l10n_util.cc index 1039a1d..6e6849c 100644 --- a/chrome/common/l10n_util.cc +++ b/chrome/common/l10n_util.cc @@ -6,6 +6,7 @@ #include "chrome/common/l10n_util.h" +#include "app/resource_bundle.h" #include "base/command_line.h" #include "base/file_util.h" #include "base/path_service.h" @@ -17,7 +18,6 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/gfx/chrome_canvas.h" -#include "chrome/common/resource_bundle.h" #include "unicode/uscript.h" // TODO(playmobil): remove this undef once SkPostConfig.h is fixed. diff --git a/chrome/common/resource_bundle.cc b/chrome/common/resource_bundle.cc deleted file mode 100644 index 3ffc026..0000000 --- a/chrome/common/resource_bundle.cc +++ /dev/null @@ -1,205 +0,0 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/common/resource_bundle.h" - -#include "base/gfx/png_decoder.h" -#include "base/logging.h" -#include "base/string_piece.h" -#include "net/base/file_stream.h" -#include "net/base/net_errors.h" -#include "chrome/common/gfx/chrome_font.h" -#include "SkBitmap.h" - -ResourceBundle* ResourceBundle::g_shared_instance_ = NULL; - -/* static */ -void ResourceBundle::InitSharedInstance(const std::wstring& pref_locale) { - DCHECK(g_shared_instance_ == NULL) << "ResourceBundle initialized twice"; - g_shared_instance_ = new ResourceBundle(); - - g_shared_instance_->LoadResources(pref_locale); -} - -/* static */ -void ResourceBundle::CleanupSharedInstance() { - if (g_shared_instance_) { - delete g_shared_instance_; - g_shared_instance_ = NULL; - } -} - -/* static */ -ResourceBundle& ResourceBundle::GetSharedInstance() { - // Must call InitSharedInstance before this function. - CHECK(g_shared_instance_ != NULL); - return *g_shared_instance_; -} - -ResourceBundle::ResourceBundle() - : resources_data_(NULL), - locale_resources_data_(NULL), - theme_data_(NULL) { -} - -void ResourceBundle::FreeImages() { - for (SkImageMap::iterator i = skia_images_.begin(); - i != skia_images_.end(); i++) { - delete i->second; - } - skia_images_.clear(); -} - -void ResourceBundle::SetThemeExtension(const Extension& e) { - theme_extension_.reset(new Extension(e)); -} - -/* static */ -SkBitmap* ResourceBundle::LoadBitmap(DataHandle data_handle, int resource_id) { - std::vector raw_data, png_data; - bool success = false; - // First check to see if we have a registered theme extension and whether - // it can handle this resource. - // TODO(erikkay): It would be nice to use something less brittle than - // resource_id here. - if (g_shared_instance_->theme_extension_.get()) { - FilePath path = - g_shared_instance_->theme_extension_->GetThemeResourcePath(resource_id); - if (!path.empty()) { - net::FileStream file; - int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ; - if (file.Open(path, flags) == net::OK) { - int64 avail = file.Available(); - if (avail > 0 && avail < INT_MAX) { - size_t size = static_cast(avail); - raw_data.resize(size); - char* data = reinterpret_cast(&(raw_data.front())); - if (file.ReadUntilComplete(data, size) == avail) { - success= true; - } else { - raw_data.resize(0); - } - } - } - } - } - if (!success) - success = LoadResourceBytes(data_handle, resource_id, &raw_data); - if (!success) - return NULL; - - // Decode the PNG. - int image_width; - int image_height; - if (!PNGDecoder::Decode(&raw_data.front(), raw_data.size(), - PNGDecoder::FORMAT_BGRA, - &png_data, &image_width, &image_height)) { - NOTREACHED() << "Unable to decode image resource " << resource_id; - return NULL; - } - - return PNGDecoder::CreateSkBitmapFromBGRAFormat(png_data, - image_width, - image_height); -} - -std::string ResourceBundle::GetDataResource(int resource_id) { - return GetRawDataResource(resource_id).as_string(); -} - -bool ResourceBundle::LoadImageResourceBytes(int resource_id, - std::vector* bytes) { - return LoadResourceBytes(theme_data_, resource_id, bytes); -} - -bool ResourceBundle::LoadDataResourceBytes(int resource_id, - std::vector* bytes) { - return LoadResourceBytes(resources_data_, resource_id, bytes); -} - -SkBitmap* ResourceBundle::GetBitmapNamed(int resource_id) { - // Check to see if we already have the Skia image in the cache. - { - AutoLock lock_scope(lock_); - SkImageMap::const_iterator found = skia_images_.find(resource_id); - if (found != skia_images_.end()) - return found->second; - } - - scoped_ptr bitmap; - - if (theme_data_) - bitmap.reset(LoadBitmap(theme_data_, resource_id)); - - // If we did not find the bitmap in the theme DLL, try the current one. - if (!bitmap.get()) - bitmap.reset(LoadBitmap(resources_data_, resource_id)); - - // We loaded successfully. Cache the Skia version of the bitmap. - if (bitmap.get()) { - AutoLock lock_scope(lock_); - - // Another thread raced us, and has already cached the skia image. - if (skia_images_.count(resource_id)) - return skia_images_[resource_id]; - - skia_images_[resource_id] = bitmap.get(); - return bitmap.release(); - } - - // We failed to retrieve the bitmap, show a debugging red square. - { - LOG(WARNING) << "Unable to load bitmap with id " << resource_id; - NOTREACHED(); // Want to assert in debug mode. - - AutoLock lock_scope(lock_); // Guard empty_bitmap initialization. - - static SkBitmap* empty_bitmap = NULL; - if (!empty_bitmap) { - // The placeholder bitmap is bright red so people notice the problem. - // This bitmap will be leaked, but this code should never be hit. - empty_bitmap = new SkBitmap(); - empty_bitmap->setConfig(SkBitmap::kARGB_8888_Config, 32, 32); - empty_bitmap->allocPixels(); - empty_bitmap->eraseARGB(255, 255, 0, 0); - } - return empty_bitmap; - } -} - -void ResourceBundle::LoadFontsIfNecessary() { - AutoLock lock_scope(lock_); - if (!base_font_.get()) { - base_font_.reset(new ChromeFont()); - - small_font_.reset(new ChromeFont()); - *small_font_ = base_font_->DeriveFont(-2); - - medium_font_.reset(new ChromeFont()); - *medium_font_ = base_font_->DeriveFont(3); - - medium_bold_font_.reset(new ChromeFont()); - *medium_bold_font_ = - base_font_->DeriveFont(3, base_font_->style() | ChromeFont::BOLD); - - large_font_.reset(new ChromeFont()); - *large_font_ = base_font_->DeriveFont(8); - } -} - -ChromeFont ResourceBundle::GetFont(FontStyle style) { - LoadFontsIfNecessary(); - switch(style) { - case SmallFont: - return *small_font_; - case MediumFont: - return *medium_font_; - case MediumBoldFont: - return *medium_bold_font_; - case LargeFont: - return *large_font_; - default: - return *base_font_; - } -} diff --git a/chrome/common/resource_bundle.h b/chrome/common/resource_bundle.h deleted file mode 100644 index 77cb88d..0000000 --- a/chrome/common/resource_bundle.h +++ /dev/null @@ -1,206 +0,0 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_COMMON_RESOURCE_BUNDLE_H__ -#define CHROME_COMMON_RESOURCE_BUNDLE_H__ - -#include "build/build_config.h" - -#if defined(OS_WIN) -#include -#endif - -#include -#include - -#include "base/basictypes.h" -#include "base/file_path.h" -#include "base/lock.h" -#include "base/scoped_ptr.h" -#include "chrome/browser/extensions/extension.h" - -#if defined(OS_LINUX) || defined(OS_MACOSX) -namespace base { - class DataPack; -}; -#endif -#if defined(OS_LINUX) -typedef struct _GdkPixbuf GdkPixbuf; -#endif -class ChromeFont; -class Extension; -class SkBitmap; -class StringPiece; - -// ResourceBundle is a central facility to load images and other resources, -// such as theme graphics. -// Every resource is loaded only once. -class ResourceBundle { - public: - // An enumeration of the various font styles used throughout Chrome. - // The following holds true for the font sizes: - // Small <= Base <= Medium <= MediumBold <= Large. - enum FontStyle { - SmallFont, - BaseFont, - MediumFont, - // NOTE: depending upon the locale, this may *not* result in a bold font. - MediumBoldFont, - LargeFont, - }; - - // Initialize the ResourceBundle for this process. - // NOTE: Mac ignores this and always loads up resources for the language - // defined by the Cocoa UI (ie-NSBundle does the langange work). - static void InitSharedInstance(const std::wstring& pref_locale); - - // Delete the ResourceBundle for this process if it exists. - static void CleanupSharedInstance(); - - // Return the global resource loader instance. - static ResourceBundle& GetSharedInstance(); - - // Load the data file that contains theme resources if present. - void LoadThemeResources(); - - // Gets the bitmap with the specified resource_id, first by looking into the - // theme data, than in the current module data if applicable. - // Returns a pointer to a shared instance of the SkBitmap. This shared bitmap - // is owned by the resource bundle and should not be freed. - // - // The bitmap is assumed to exist. This function will log in release, and - // assert in debug mode if it does not. On failure, this will return a - // pointer to a shared empty placeholder bitmap so it will be visible what - // is missing. - SkBitmap* GetBitmapNamed(int resource_id); - - // Loads the raw bytes of an image resource into |bytes|, - // without doing any processing or interpretation of - // the resource. Returns whether we successfully read the resource. - bool LoadImageResourceBytes(int resource_id, - std::vector* bytes); - - // Loads the raw bytes of a data resource into |bytes|, - // without doing any processing or interpretation of - // the resource. Returns whether we successfully read the resource. - bool LoadDataResourceBytes(int resource_id, - std::vector* bytes); - - // Return the contents of a file in a string given the resource id. - // This will copy the data from the resource and return it as a string. - // TODO(port): deprecate this and replace with GetRawDataResource to avoid - // needless copying. - std::string GetDataResource(int resource_id); - - // Like GetDataResource(), but avoids copying the resource. Instead, it - // returns a StringPiece which points into the actual resource in the image. - StringPiece GetRawDataResource(int resource_id); - - // Get a localized string given a message id. Returns an empty - // string if the message_id is not found. - string16 GetLocalizedString(int message_id); - - // Returns the font for the specified style. - ChromeFont GetFont(FontStyle style); - -#if defined(OS_WIN) - // Loads and returns an icon from the theme dll. - HICON LoadThemeIcon(int icon_id); - - // Loads and returns the global accelerators. - HACCEL GetGlobalAccelerators(); - - // Loads and returns a cursor from the app module. - HCURSOR LoadCursor(int cursor_id); -#elif defined(OS_LINUX) - // Gets the GdkPixbuf with the specified resource_id, first by looking into - // the theme data, than in the current module data if applicable. Returns a - // pointer to a shared instance of the GdkPixbuf. This shared GdkPixbuf is - // owned by the resource bundle and should not be freed. - // - // The bitmap is assumed to exist. This function will log in release, and - // assert in debug mode if it does not. On failure, this will return a - // pointer to a shared empty placeholder bitmap so it will be visible what - // is missing. - GdkPixbuf* GetPixbufNamed(int resource_id); -#endif - - // Sets an Extension object that can handle theme resource requests. - void SetThemeExtension(const Extension& e); - - private: - // We define a DataHandle typedef to abstract across how data is stored - // across platforms. -#if defined(OS_WIN) - // Windows stores resources in DLLs, which are managed by HINSTANCE. - typedef HINSTANCE DataHandle; -#elif defined(OS_LINUX) || defined(OS_MACOSX) - // Linux uses base::DataPack. - typedef base::DataPack* DataHandle; -#endif - - // Ctor/dtor are private, since we're a singleton. - ResourceBundle(); - ~ResourceBundle(); - - // Free skia_images_. - void FreeImages(); - - // Try to load the main resources and the locale specific strings from an - // external data module. - void LoadResources(const std::wstring& pref_locale); - - // Initialize all the ChromeFont members if they haven't yet been initialized. - void LoadFontsIfNecessary(); - - // Returns the full pathname of the locale file to load. May return an empty - // string if no locale data files are found. - FilePath GetLocaleFilePath(const std::wstring& pref_locale); - - // Loads the raw bytes of a resource from |module| into |bytes|, - // without doing any processing or interpretation of - // the resource. Returns whether we successfully read the resource. - static bool LoadResourceBytes(DataHandle module, - int resource_id, - std::vector* bytes); - - // Creates and returns a new SkBitmap given the data file to look in and the - // resource id. It's up to the caller to free the returned bitmap when - // done. - static SkBitmap* LoadBitmap(DataHandle dll_inst, int resource_id); - - // Class level lock. Used to protect internal data structures that may be - // accessed from other threads (e.g., skia_images_). - Lock lock_; - - // Handles for data sources. - DataHandle resources_data_; - DataHandle locale_resources_data_; - DataHandle theme_data_; - - // Cached images. The ResourceBundle caches all retrieved bitmaps and keeps - // ownership of the pointers. - typedef std::map SkImageMap; - SkImageMap skia_images_; -#if defined(OS_LINUX) - typedef std::map GdkPixbufMap; - GdkPixbufMap gdk_pixbufs_; -#endif - - // The various fonts used. Cached to avoid repeated GDI creation/destruction. - scoped_ptr base_font_; - scoped_ptr small_font_; - scoped_ptr medium_font_; - scoped_ptr medium_bold_font_; - scoped_ptr large_font_; - scoped_ptr web_font_; - - static ResourceBundle* g_shared_instance_; - - scoped_ptr theme_extension_; - - DISALLOW_EVIL_CONSTRUCTORS(ResourceBundle); -}; - -#endif // CHROME_COMMON_RESOURCE_BUNDLE_H__ diff --git a/chrome/common/resource_bundle_linux.cc b/chrome/common/resource_bundle_linux.cc deleted file mode 100644 index bad1da7..0000000 --- a/chrome/common/resource_bundle_linux.cc +++ /dev/null @@ -1,209 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/common/resource_bundle.h" - -#include - -#include "base/base_paths.h" -#include "base/data_pack.h" -#include "base/file_path.h" -#include "base/file_util.h" -#include "base/gfx/gtk_util.h" -#include "base/logging.h" -#include "base/path_service.h" -#include "base/string_piece.h" -#include "base/string_util.h" -#include "chrome/common/chrome_paths.h" -#include "chrome/common/gfx/chrome_font.h" -#include "chrome/common/gtk_util.h" -#include "chrome/common/l10n_util.h" -#include "SkBitmap.h" - -namespace { - -// Convert the raw image data into a GdkPixbuf. The GdkPixbuf that is returned -// has a ref count of 1 so the caller must call g_object_unref to free the -// memory. -GdkPixbuf* LoadPixbuf(std::vector& data) { - ScopedGObject::Type loader(gdk_pixbuf_loader_new()); - bool ok = gdk_pixbuf_loader_write(loader.get(), - static_cast(data.data()), data.size(), NULL); - if (!ok) - return NULL; - // Calling gdk_pixbuf_loader_close forces the data to be parsed by the - // loader. We must do this before calling gdk_pixbuf_loader_get_pixbuf. - ok = gdk_pixbuf_loader_close(loader.get(), NULL); - if (!ok) - return NULL; - GdkPixbuf* pixbuf = gdk_pixbuf_loader_get_pixbuf(loader.get()); - if (!pixbuf) - return NULL; - - // The pixbuf is owned by the loader, so add a ref so when we delete the - // loader (when the ScopedGObject goes out of scope), the pixbuf still - // exists. - g_object_ref(pixbuf); - - return pixbuf; -} - -} // namespace - -ResourceBundle::~ResourceBundle() { - FreeImages(); - // Free GdkPixbufs. - for (GdkPixbufMap::iterator i = gdk_pixbufs_.begin(); - i != gdk_pixbufs_.end(); i++) { - g_object_unref(i->second); - } - gdk_pixbufs_.clear(); - - delete locale_resources_data_; - locale_resources_data_ = NULL; - delete theme_data_; - theme_data_ = NULL; - delete resources_data_; - resources_data_ = NULL; -} - -void ResourceBundle::LoadResources(const std::wstring& pref_locale) { - FilePath resources_data_path; - PathService::Get(base::DIR_EXE, &resources_data_path); - resources_data_path = resources_data_path.Append( - FILE_PATH_LITERAL("chrome.pak")); - DCHECK(resources_data_ == NULL) << "resource data already loaded!"; - resources_data_ = new base::DataPack; - bool success = resources_data_->Load(resources_data_path); - DCHECK(success) << "failed to load chrome.pak"; - - DCHECK(locale_resources_data_ == NULL) << "locale data already loaded!"; - const FilePath& locale_path = GetLocaleFilePath(pref_locale); - if (locale_path.value().empty()) { - // It's possible that there are no locale dlls found, in which case we just - // return. - NOTREACHED(); - return; - } - - locale_resources_data_ = new base::DataPack; - success = locale_resources_data_->Load(locale_path); - DCHECK(success) << "failed to load locale pak file"; -} - -FilePath ResourceBundle::GetLocaleFilePath(const std::wstring& pref_locale) { - FilePath locale_path; - PathService::Get(chrome::DIR_LOCALES, &locale_path); - - const std::wstring app_locale = l10n_util::GetApplicationLocale(pref_locale); - if (app_locale.empty()) - return FilePath(); - - return locale_path.Append(WideToASCII(app_locale + L".pak")); -} - -void ResourceBundle::LoadThemeResources() { - FilePath theme_data_path; - PathService::Get(chrome::DIR_THEMES, &theme_data_path); - theme_data_path = theme_data_path.Append(FILE_PATH_LITERAL("default.pak")); - theme_data_ = new base::DataPack; - bool success = theme_data_->Load(theme_data_path); - DCHECK(success) << "failed to load theme data"; -} - -/* static */ -bool ResourceBundle::LoadResourceBytes(DataHandle module, int resource_id, - std::vector* bytes) { - DCHECK(module); - StringPiece data; - if (!module->Get(resource_id, &data)) - return false; - - bytes->resize(data.length()); - memcpy(&(bytes->front()), data.data(), data.length()); - - return true; -} - -StringPiece ResourceBundle::GetRawDataResource(int resource_id) { - DCHECK(resources_data_); - StringPiece data; - if (!resources_data_->Get(resource_id, &data)) - return StringPiece(); - return data; -} - -string16 ResourceBundle::GetLocalizedString(int message_id) { - // If for some reason we were unable to load a resource dll, return an empty - // string (better than crashing). - if (!locale_resources_data_) { - LOG(WARNING) << "locale resources are not loaded"; - return string16(); - } - - StringPiece data; - if (!locale_resources_data_->Get(message_id, &data)) { - // Fall back on the main data pack (shouldn't be any strings here except in - // unittests). - data = GetRawDataResource(message_id); - if (data.empty()) { - NOTREACHED() << "unable to find resource: " << message_id; - return string16(); - } - } - - // Data pack encodes strings as UTF16. - string16 msg(reinterpret_cast(data.data()), - data.length() / 2); - return msg; -} - -GdkPixbuf* ResourceBundle::GetPixbufNamed(int resource_id) { - // Check to see if we already have the pixbuf in the cache. - { - AutoLock lock_scope(lock_); - GdkPixbufMap::const_iterator found = gdk_pixbufs_.find(resource_id); - if (found != gdk_pixbufs_.end()) - return found->second; - } - - - std::vector data; - LoadImageResourceBytes(resource_id, &data); - GdkPixbuf* pixbuf = LoadPixbuf(data); - - // We loaded successfully. Cache the pixbuf. - if (pixbuf) { - AutoLock lock_scope(lock_); - - // Another thread raced us, and has already cached the pixbuf. - if (gdk_pixbufs_.count(resource_id)) { - g_object_unref(pixbuf); - return gdk_pixbufs_[resource_id]; - } - - gdk_pixbufs_[resource_id] = pixbuf; - return pixbuf; - } - - // We failed to retrieve the bitmap, show a debugging red square. - { - LOG(WARNING) << "Unable to load GdkPixbuf with id " << resource_id; - NOTREACHED(); // Want to assert in debug mode. - - AutoLock lock_scope(lock_); // Guard empty_bitmap initialization. - - static GdkPixbuf* empty_bitmap = NULL; - if (!empty_bitmap) { - // The placeholder bitmap is bright red so people notice the problem. - // This bitmap will be leaked, but this code should never be hit. - scoped_ptr skia_bitmap(new SkBitmap()); - skia_bitmap->setConfig(SkBitmap::kARGB_8888_Config, 32, 32); - skia_bitmap->allocPixels(); - skia_bitmap->eraseARGB(255, 255, 0, 0); - empty_bitmap = gfx::GdkPixbufFromSkBitmap(skia_bitmap.get()); - } - return empty_bitmap; - } -} diff --git a/chrome/common/resource_bundle_mac.mm b/chrome/common/resource_bundle_mac.mm deleted file mode 100644 index 0a6664f..0000000 --- a/chrome/common/resource_bundle_mac.mm +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/common/resource_bundle.h" - -#import - -#include "base/base_paths.h" -#include "base/data_pack.h" -#include "base/file_path.h" -#include "base/file_util.h" -#include "base/logging.h" -#include "base/mac_util.h" -#include "base/path_service.h" -#include "base/string_piece.h" -#include "base/string_util.h" -#include "chrome/common/chrome_paths.h" -#include "chrome/common/gfx/chrome_font.h" -#include "chrome/common/l10n_util.h" - - -ResourceBundle::~ResourceBundle() { - FreeImages(); - - delete locale_resources_data_; - locale_resources_data_ = NULL; - delete theme_data_; - theme_data_ = NULL; - delete resources_data_; - resources_data_ = NULL; -} - -namespace { - -base::DataPack *LoadResourceDataPack(NSString *name) { - base::DataPack *resource_pack = NULL; - - NSString *resource_path = [mac_util::MainAppBundle() pathForResource:name - ofType:@"pak"]; - if (resource_path) { - FilePath resources_pak_path([resource_path fileSystemRepresentation]); - resource_pack = new base::DataPack; - bool success = resource_pack->Load(resources_pak_path); - if (!success) { - delete resource_pack; - resource_pack = NULL; - } - } - - return resource_pack; -} - -} // namespace - -void ResourceBundle::LoadResources(const std::wstring& pref_locale) { - DLOG_IF(WARNING, pref_locale.size() != 0) - << "ignoring requested locale in favor of NSBundle's selection"; - - DCHECK(resources_data_ == NULL) << "resource data already loaded!"; - resources_data_ = LoadResourceDataPack(@"chrome"); - DCHECK(resources_data_) << "failed to load chrome.pak"; - - DCHECK(locale_resources_data_ == NULL) << "locale data already loaded!"; - locale_resources_data_ = LoadResourceDataPack(@"locale"); - DCHECK(locale_resources_data_) << "failed to load locale.pak"; -} - -void ResourceBundle::LoadThemeResources() { - DCHECK(theme_data_ == NULL) << "theme data already loaded!"; - theme_data_ = LoadResourceDataPack(@"theme"); - DCHECK(theme_data_) << "failed to load theme.pak"; -} - -/* static */ -bool ResourceBundle::LoadResourceBytes(DataHandle module, int resource_id, - std::vector* bytes) { - DCHECK(module); - StringPiece data; - if (!module->Get(resource_id, &data)) - return false; - - bytes->resize(data.length()); - memcpy(&(bytes->front()), data.data(), data.length()); - - return true; -} - -StringPiece ResourceBundle::GetRawDataResource(int resource_id) { - DCHECK(resources_data_); - StringPiece data; - if (!resources_data_->Get(resource_id, &data)) - return StringPiece(); - return data; -} - -string16 ResourceBundle::GetLocalizedString(int message_id) { - // If for some reason we were unable to load a resource dll, return an empty - // string (better than crashing). - if (!locale_resources_data_) { - LOG(WARNING) << "locale resources are not loaded"; - return string16(); - } - - StringPiece data; - if (!locale_resources_data_->Get(message_id, &data)) { - // Fall back on the main data pack (shouldn't be any strings here except in - // unittests). - data = GetRawDataResource(message_id); - if (data.empty()) { - NOTREACHED() << "unable to find resource: " << message_id; - return string16(); - } - } - - // Data pack encodes strings as UTF16. - string16 msg(reinterpret_cast(data.data()), - data.length() / 2); - return msg; -} diff --git a/chrome/common/resource_bundle_win.cc b/chrome/common/resource_bundle_win.cc deleted file mode 100644 index 532193d..0000000 --- a/chrome/common/resource_bundle_win.cc +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/common/resource_bundle.h" - -#include - -#include "base/file_util.h" -#include "base/logging.h" -#include "base/path_service.h" -#include "base/resource_util.h" -#include "base/string_piece.h" -#include "base/win_util.h" -#include "chrome/app/chrome_dll_resource.h" -#include "chrome/common/chrome_paths.h" -#include "chrome/common/gfx/chrome_font.h" -#include "chrome/common/l10n_util.h" - -namespace { - -// Returns the flags that should be passed to LoadLibraryEx. -DWORD GetDataDllLoadFlags() { - if (win_util::GetWinVersion() >= win_util::WINVERSION_VISTA) - return LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE | LOAD_LIBRARY_AS_IMAGE_RESOURCE; - - return DONT_RESOLVE_DLL_REFERENCES; -} - -} // end anonymous namespace - -ResourceBundle::~ResourceBundle() { - FreeImages(); - - if (locale_resources_data_) { - BOOL rv = FreeLibrary(locale_resources_data_); - DCHECK(rv); - } - if (theme_data_) { - BOOL rv = FreeLibrary(theme_data_); - DCHECK(rv); - } -} - -void ResourceBundle::LoadResources(const std::wstring& pref_locale) { - // As a convenience, set resources_data_ to the current module. - resources_data_ = _AtlBaseModule.GetModuleInstance(); - - DCHECK(NULL == locale_resources_data_) << "locale dll already loaded"; - const FilePath& locale_path = GetLocaleFilePath(pref_locale); - if (locale_path.value().empty()) { - // It's possible that there are no locale dlls found, in which case we just - // return. - NOTREACHED(); - return; - } - - // The dll should only have resources, not executable code. - locale_resources_data_ = LoadLibraryEx(locale_path.value().c_str(), NULL, - GetDataDllLoadFlags()); - DCHECK(locale_resources_data_ != NULL) << - "unable to load generated resources"; -} - -FilePath ResourceBundle::GetLocaleFilePath(const std::wstring& pref_locale) { - FilePath locale_path; - PathService::Get(chrome::DIR_LOCALES, &locale_path); - - const std::wstring app_locale = l10n_util::GetApplicationLocale(pref_locale); - if (app_locale.empty()) - return FilePath(); - - return locale_path.Append(app_locale + L".dll"); -} - -void ResourceBundle::LoadThemeResources() { - DCHECK(NULL == theme_data_) << "theme dll already loaded"; - std::wstring theme_data_path; - PathService::Get(chrome::DIR_THEMES, &theme_data_path); - file_util::AppendToPath(&theme_data_path, L"default.dll"); - - // The dll should only have resources, not executable code. - theme_data_ = LoadLibraryEx(theme_data_path.c_str(), NULL, - GetDataDllLoadFlags()); - DCHECK(theme_data_ != NULL) << "unable to load " << theme_data_path; -} - -/* static */ -bool ResourceBundle::LoadResourceBytes( - DataHandle module, - int resource_id, - std::vector* bytes) { - void* data_ptr; - size_t data_size; - if (base::GetDataResourceFromModule(module, resource_id, &data_ptr, - &data_size)) { - bytes->resize(data_size); - memcpy(&(bytes->front()), data_ptr, data_size); - return true; - } else { - return false; - } -} - -HICON ResourceBundle::LoadThemeIcon(int icon_id) { - return ::LoadIcon(theme_data_, MAKEINTRESOURCE(icon_id)); -} - -StringPiece ResourceBundle::GetRawDataResource(int resource_id) { - void* data_ptr; - size_t data_size; - if (base::GetDataResourceFromModule(_AtlBaseModule.GetModuleInstance(), - resource_id, - &data_ptr, - &data_size)) { - return StringPiece(static_cast(data_ptr), data_size); - } else if (locale_resources_data_ && - base::GetDataResourceFromModule(locale_resources_data_, - resource_id, - &data_ptr, - &data_size)) { - return StringPiece(static_cast(data_ptr), data_size); - } - return StringPiece(); -} -// Loads and returns the global accelerators from the current module. -HACCEL ResourceBundle::GetGlobalAccelerators() { - return ::LoadAccelerators(_AtlBaseModule.GetModuleInstance(), - MAKEINTRESOURCE(IDR_MAINFRAME)); -} - -// Loads and returns a cursor from the current module. -HCURSOR ResourceBundle::LoadCursor(int cursor_id) { - return ::LoadCursor(_AtlBaseModule.GetModuleInstance(), - MAKEINTRESOURCE(cursor_id)); -} - -string16 ResourceBundle::GetLocalizedString(int message_id) { - // If for some reason we were unable to load a resource dll, return an empty - // string (better than crashing). - if (!locale_resources_data_) { - LOG(WARNING) << "locale resources are not loaded"; - return string16(); - } - - DCHECK(IS_INTRESOURCE(message_id)); - - // Get a reference directly to the string resource. - HINSTANCE hinstance = locale_resources_data_; - const ATLSTRINGRESOURCEIMAGE* image = AtlGetStringResourceImage(hinstance, - message_id); - if (!image) { - // Fall back on the current module (shouldn't be any strings here except - // in unittests). - image = AtlGetStringResourceImage(_AtlBaseModule.GetModuleInstance(), - message_id); - if (!image) { - NOTREACHED() << "unable to find resource: " << message_id; - return std::wstring(); - } - } - // Copy into a string16 and return. - return string16(image->achString, image->nLength); -} diff --git a/chrome/common/security_filter_peer.cc b/chrome/common/security_filter_peer.cc index e3c5cf0..67ed158 100644 --- a/chrome/common/security_filter_peer.cc +++ b/chrome/common/security_filter_peer.cc @@ -4,11 +4,11 @@ #include "chrome/common/security_filter_peer.h" +#include "app/resource_bundle.h" #include "base/gfx/png_encoder.h" #include "base/gfx/size.h" #include "base/string_util.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "grit/generated_resources.h" #include "grit/renderer_resources.h" #include "net/base/net_errors.h" diff --git a/chrome/renderer/extensions/bindings_utils.h b/chrome/renderer/extensions/bindings_utils.h index 84fb32f..f7dbba3 100755 --- a/chrome/renderer/extensions/bindings_utils.h +++ b/chrome/renderer/extensions/bindings_utils.h @@ -5,8 +5,8 @@ #ifndef CHROME_RENDERER_EXTENSIONS_BINDINGS_UTILS_H_ #define CHROME_RENDERER_EXTENSIONS_BINDINGS_UTILS_H_ +#include "app/resource_bundle.h" #include "base/singleton.h" -#include "chrome/common/resource_bundle.h" #include diff --git a/chrome/renderer/extensions/greasemonkey_api_unittest.cc b/chrome/renderer/extensions/greasemonkey_api_unittest.cc index a0c3ee6..2687953 100755 --- a/chrome/renderer/extensions/greasemonkey_api_unittest.cc +++ b/chrome/renderer/extensions/greasemonkey_api_unittest.cc @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "app/resource_bundle.h" #include "base/file_util.h" #include "base/path_service.h" #include "base/string_util.h" #include "chrome/common/chrome_paths.h" -#include "chrome/common/resource_bundle.h" #include "chrome/test/v8_unit_test.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/renderer/extensions/json_schema_unittest.cc b/chrome/renderer/extensions/json_schema_unittest.cc index 15a4d8c..7d4073f 100755 --- a/chrome/renderer/extensions/json_schema_unittest.cc +++ b/chrome/renderer/extensions/json_schema_unittest.cc @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "app/resource_bundle.h" #include "base/file_util.h" #include "base/path_service.h" #include "base/string_util.h" #include "chrome/common/chrome_paths.h" -#include "chrome/common/resource_bundle.h" #include "chrome/test/v8_unit_test.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/renderer/extensions/renderer_extension_bindings.cc b/chrome/renderer/extensions/renderer_extension_bindings.cc index 28b5c47..fe0656b 100755 --- a/chrome/renderer/extensions/renderer_extension_bindings.cc +++ b/chrome/renderer/extensions/renderer_extension_bindings.cc @@ -4,9 +4,9 @@ #include "chrome/renderer/extensions/renderer_extension_bindings.h" +#include "app/resource_bundle.h" #include "base/basictypes.h" #include "chrome/common/render_messages.h" -#include "chrome/common/resource_bundle.h" #include "chrome/renderer/extensions/bindings_utils.h" #include "chrome/renderer/extensions/event_bindings.h" #include "chrome/renderer/render_thread.h" diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 919a248..6664d1c 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -8,6 +8,7 @@ #include #include +#include "app/resource_bundle.h" #include "base/command_line.h" #include "base/compiler_specific.h" #include "base/gfx/png_encoder.h" @@ -24,7 +25,6 @@ #include "chrome/common/message_box_flags.h" #include "chrome/common/page_zoom.h" #include "chrome/common/render_messages.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/thumbnail_score.h" #include "chrome/common/url_constants.h" #include "chrome/renderer/about_handler.h" diff --git a/chrome/renderer/renderer_glue.cc b/chrome/renderer/renderer_glue.cc index b649629..75c4063 100644 --- a/chrome/renderer/renderer_glue.cc +++ b/chrome/renderer/renderer_glue.cc @@ -13,12 +13,12 @@ #include #endif +#include "app/resource_bundle.h" #include "base/clipboard.h" #include "base/scoped_clipboard_writer.h" #include "base/string_util.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/render_messages.h" -#include "chrome/common/resource_bundle.h" #include "chrome/plugin/npobject_util.h" #include "chrome/renderer/net/render_dns_master.h" #include "chrome/renderer/render_process.h" diff --git a/chrome/renderer/renderer_main.cc b/chrome/renderer/renderer_main.cc index 2295edb..33e1742 100644 --- a/chrome/renderer/renderer_main.cc +++ b/chrome/renderer/renderer_main.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "app/resource_bundle.h" #include "base/command_line.h" #include "base/histogram.h" #include "base/message_loop.h" @@ -18,7 +19,6 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/logging_chrome.h" #include "chrome/common/main_function_params.h" -#include "chrome/common/resource_bundle.h" #include "chrome/renderer/renderer_main_platform_delegate.h" #include "chrome/renderer/render_process.h" #include "grit/chromium_strings.h" diff --git a/chrome/renderer/user_script_slave.cc b/chrome/renderer/user_script_slave.cc index 651e9ad..80eba6c 100644 --- a/chrome/renderer/user_script_slave.cc +++ b/chrome/renderer/user_script_slave.cc @@ -4,13 +4,13 @@ #include "chrome/renderer/user_script_slave.h" +#include "app/resource_bundle.h" #include "base/histogram.h" #include "base/logging.h" #include "base/perftimer.h" #include "base/pickle.h" #include "base/shared_memory.h" #include "base/string_util.h" -#include "chrome/common/resource_bundle.h" #include "googleurl/src/gurl.h" #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" #include "webkit/glue/webframe.h" diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index 2a35b3c..2570390 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -10,6 +10,7 @@ #include #endif +#include "app/resource_bundle.h" #include "base/logging.h" #include "base/ref_counted.h" #include "base/string_util.h" @@ -20,7 +21,6 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/plugin_messages.h" #include "chrome/common/render_messages.h" -#include "chrome/common/resource_bundle.h" #include "chrome/plugin/npobject_proxy.h" #include "chrome/plugin/npobject_stub.h" #include "chrome/renderer/render_thread.h" diff --git a/chrome/test/unit/chrome_test_suite.h b/chrome/test/unit/chrome_test_suite.h index baf21af..ff187da 100644 --- a/chrome/test/unit/chrome_test_suite.h +++ b/chrome/test/unit/chrome_test_suite.h @@ -9,6 +9,7 @@ #include +#include "app/resource_bundle.h" #include "base/stats_table.h" #include "base/file_path.h" #if defined(OS_MACOSX) @@ -22,7 +23,6 @@ #include "chrome/browser/browser_process.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/resource_bundle.h" #include "chrome/test/testing_browser_process.h" #include "net/base/host_resolver_unittest.h" #include "net/base/net_util.h" diff --git a/chrome/views/controls/button/menu_button.cc b/chrome/views/controls/button/menu_button.cc index 4687132..9f0ec74 100644 --- a/chrome/views/controls/button/menu_button.cc +++ b/chrome/views/controls/button/menu_button.cc @@ -4,10 +4,10 @@ #include "chrome/views/controls/button/menu_button.h" +#include "app/resource_bundle.h" #include "chrome/common/drag_drop_types.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" #include "chrome/views/controls/button/button.h" #include "chrome/views/controls/menu/view_menu_delegate.h" diff --git a/chrome/views/controls/button/text_button.cc b/chrome/views/controls/button/text_button.cc index a273d20..5457281 100644 --- a/chrome/views/controls/button/text_button.cc +++ b/chrome/views/controls/button/text_button.cc @@ -4,9 +4,9 @@ #include "chrome/views/controls/button/text_button.h" +#include "app/resource_bundle.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/throb_animation.h" #include "chrome/views/controls/button/button.h" #include "chrome/views/event.h" diff --git a/chrome/views/controls/combo_box.cc b/chrome/views/controls/combo_box.cc index 0c063ac..6d62fce 100644 --- a/chrome/views/controls/combo_box.cc +++ b/chrome/views/controls/combo_box.cc @@ -4,12 +4,12 @@ #include "chrome/views/controls/combo_box.h" +#include "app/resource_bundle.h" #include "base/gfx/native_theme.h" #include "base/gfx/rect.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/chrome_font.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" // Limit how small a combobox can be. static const int kMinComboboxWidth = 148; diff --git a/chrome/views/controls/label.cc b/chrome/views/controls/label.cc index f517686..b14527e 100644 --- a/chrome/views/controls/label.cc +++ b/chrome/views/controls/label.cc @@ -6,6 +6,7 @@ #include +#include "app/resource_bundle.h" #include "base/logging.h" #include "base/string_util.h" #include "chrome/common/gfx/chrome_canvas.h" @@ -13,7 +14,6 @@ #include "chrome/common/gfx/insets.h" #include "chrome/common/gfx/text_elider.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/background.h" namespace views { diff --git a/chrome/views/controls/scroll_view.cc b/chrome/views/controls/scroll_view.cc index 49787ed..753f6c5 100644 --- a/chrome/views/controls/scroll_view.cc +++ b/chrome/views/controls/scroll_view.cc @@ -4,8 +4,8 @@ #include "chrome/views/controls/scroll_view.h" +#include "app/resource_bundle.h" #include "base/logging.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/controls/scrollbar/native_scroll_bar.h" #include "chrome/views/widget/root_view.h" #include "grit/theme_resources.h" diff --git a/chrome/views/controls/tabbed_pane.cc b/chrome/views/controls/tabbed_pane.cc index 7f42e40..cfd49c7 100644 --- a/chrome/views/controls/tabbed_pane.cc +++ b/chrome/views/controls/tabbed_pane.cc @@ -6,12 +6,12 @@ #include +#include "app/resource_bundle.h" #include "base/gfx/native_theme.h" #include "base/logging.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/chrome_font.h" #include "chrome/common/l10n_util_win.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/stl_util-inl.h" #include "chrome/common/throb_animation.h" #include "chrome/views/background.h" diff --git a/chrome/views/controls/table/table_view.cc b/chrome/views/controls/table/table_view.cc index 35a0140..828aeae 100644 --- a/chrome/views/controls/table/table_view.cc +++ b/chrome/views/controls/table/table_view.cc @@ -7,13 +7,13 @@ #include #include +#include "app/resource_bundle.h" #include "base/string_util.h" #include "base/win_util.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/favicon_size.h" #include "chrome/common/gfx/icon_util.h" #include "chrome/common/l10n_util_win.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" #include "chrome/views/controls/hwnd_view.h" #include "SkBitmap.h" diff --git a/chrome/views/controls/throbber.cc b/chrome/views/controls/throbber.cc index 8d5a902..5bf9ce5 100644 --- a/chrome/views/controls/throbber.cc +++ b/chrome/views/controls/throbber.cc @@ -4,10 +4,10 @@ #include "chrome/views/controls/throbber.h" +#include "app/resource_bundle.h" #include "base/time.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/logging_chrome.h" -#include "chrome/common/resource_bundle.h" #include "grit/theme_resources.h" #include "skia/include/SkBitmap.h" diff --git a/chrome/views/controls/tree/tree_view.cc b/chrome/views/controls/tree/tree_view.cc index 7677828..a8367b2 100644 --- a/chrome/views/controls/tree/tree_view.cc +++ b/chrome/views/controls/tree/tree_view.cc @@ -6,12 +6,12 @@ #include +#include "app/resource_bundle.h" #include "base/win_util.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/icon_util.h" #include "chrome/common/l10n_util.h" #include "chrome/common/l10n_util_win.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/stl_util-inl.h" #include "chrome/views/focus/focus_manager.h" #include "chrome/views/widget/widget.h" diff --git a/chrome/views/focus/focus_manager_unittest.cc b/chrome/views/focus/focus_manager_unittest.cc index 1246de7..613f701 100644 --- a/chrome/views/focus/focus_manager_unittest.cc +++ b/chrome/views/focus/focus_manager_unittest.cc @@ -8,8 +8,8 @@ // the events don't go to the Chrome window. #include "testing/gtest/include/gtest/gtest.h" +#include "app/resource_bundle.h" #include "base/gfx/rect.h" -#include "chrome/common/resource_bundle.h" #include "chrome/views/background.h" #include "chrome/views/border.h" #include "chrome/views/controls/button/checkbox.h" diff --git a/chrome/views/painter.cc b/chrome/views/painter.cc index 7e0897c..bfddce5 100644 --- a/chrome/views/painter.cc +++ b/chrome/views/painter.cc @@ -4,9 +4,9 @@ #include "chrome/views/painter.h" +#include "app/resource_bundle.h" #include "base/logging.h" #include "chrome/common/gfx/chrome_canvas.h" -#include "chrome/common/resource_bundle.h" #include "skia/include/SkBitmap.h" #include "skia/include/SkGradientShader.h" diff --git a/chrome/views/window/custom_frame_view.cc b/chrome/views/window/custom_frame_view.cc index 9c07817..e6524de 100644 --- a/chrome/views/window/custom_frame_view.cc +++ b/chrome/views/window/custom_frame_view.cc @@ -4,11 +4,11 @@ #include "chrome/views/window/custom_frame_view.h" +#include "app/resource_bundle.h" #include "base/win_util.h" #include "chrome/common/gfx/path.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/chrome_font.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" #include "chrome/views/window/client_view.h" #include "chrome/views/window/window_delegate.h" diff --git a/chrome/views/window/dialog_client_view.cc b/chrome/views/window/dialog_client_view.cc index f7fbcad..13ee1f0 100644 --- a/chrome/views/window/dialog_client_view.cc +++ b/chrome/views/window/dialog_client_view.cc @@ -8,12 +8,12 @@ #include #include +#include "app/resource_bundle.h" #include "base/gfx/native_theme.h" #include "chrome/browser/views/standard_layout.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/chrome_font.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" #include "chrome/views/controls/button/native_button.h" #include "chrome/views/window/dialog_delegate.h" diff --git a/chrome/views/window/window_win.cc b/chrome/views/window/window_win.cc index 8a53e2f..83e09e4 100644 --- a/chrome/views/window/window_win.cc +++ b/chrome/views/window/window_win.cc @@ -6,6 +6,7 @@ #include +#include "app/resource_bundle.h" #include "base/win_util.h" #include "chrome/app/chrome_dll_resource.h" #include "chrome/common/gfx/chrome_canvas.h" @@ -15,7 +16,6 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/notification_service.h" #include "chrome/common/pref_service.h" -#include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" #include "chrome/views/widget/root_view.h" #include "chrome/views/window/client_view.h" -- cgit v1.1