diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-24 05:16:08 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-24 05:16:08 +0000 |
commit | ac55e29f93a7f7edc2ddac6d909f5c25bf5d7cba (patch) | |
tree | a4093c4446401ab09643c045701e901142ba91b6 /content | |
parent | 45661171f72daa6250088584a6067a3202d3632a (diff) | |
download | chromium_src-ac55e29f93a7f7edc2ddac6d909f5c25bf5d7cba.zip chromium_src-ac55e29f93a7f7edc2ddac6d909f5c25bf5d7cba.tar.gz chromium_src-ac55e29f93a7f7edc2ddac6d909f5c25bf5d7cba.tar.bz2 |
Get rid of the implicit content dependency on how Chrome stores its resources. This way content and lower modules like WebKit can still know about grit, but the embedder is responsible for knowing how to fetch a resource given its id.
BUG=76697,85757
Review URL: http://codereview.chromium.org/7249016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90337 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/DEPS | 8 | ||||
-rw-r--r-- | content/browser/content_browser_client.cc | 6 | ||||
-rw-r--r-- | content/browser/content_browser_client.h | 4 | ||||
-rw-r--r-- | content/browser/speech/speech_recognition_request.cc | 1 | ||||
-rw-r--r-- | content/browser/tab_contents/navigation_controller.cc | 1 | ||||
-rw-r--r-- | content/browser/tab_contents/navigation_entry.cc | 7 | ||||
-rw-r--r-- | content/browser/tab_contents/tab_contents.cc | 1 | ||||
-rw-r--r-- | content/common/content_client.cc | 11 | ||||
-rw-r--r-- | content/common/content_client.h | 11 | ||||
-rw-r--r-- | content/renderer/renderer_glue.cc | 21 |
10 files changed, 46 insertions, 25 deletions
diff --git a/content/DEPS b/content/DEPS index 6b09f62..6049916 100644 --- a/content/DEPS +++ b/content/DEPS @@ -38,7 +38,13 @@ include_rules = [ # Allow inclusion of WebKit API files. "+third_party/WebKit/Source/WebKit/chromium", - "+ui", + "+ui/base", + "+ui/gfx", + # Content knows about grd files, but the specifics of how to get a resource + # given its id is left to the embedder. + "-ui/base/l10n", + "-ui/base/resource", + "+views", "+webkit", ] diff --git a/content/browser/content_browser_client.cc b/content/browser/content_browser_client.cc index 1ffb914..38114eb 100644 --- a/content/browser/content_browser_client.cc +++ b/content/browser/content_browser_client.cc @@ -9,6 +9,7 @@ #include "content/browser/ssl/ssl_client_auth_handler.h" #include "content/browser/webui/empty_web_ui_factory.h" #include "googleurl/src/gurl.h" +#include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/clipboard/clipboard.h" namespace content { @@ -57,6 +58,11 @@ std::string ContentBrowserClient::GetAcceptLangs(const TabContents* tab) { return std::string(); } +SkBitmap* ContentBrowserClient::GetDefaultFavicon() { + static SkBitmap empty; + return ∅ +} + bool ContentBrowserClient::AllowAppCache( const GURL& manifest_url, const content::ResourceContext& context) { return true; diff --git a/content/browser/content_browser_client.h b/content/browser/content_browser_client.h index ddebd04..eb7fda8 100644 --- a/content/browser/content_browser_client.h +++ b/content/browser/content_browser_client.h @@ -24,6 +24,7 @@ class RenderViewHost; class ResourceDispatcherHost; class SSLCertErrorHandler; class SSLClientAuthHandler; +class SkBitmap; class TabContents; class WorkerProcessHost; struct DesktopNotificationHostMsg_Show_Params; @@ -103,6 +104,9 @@ class ContentBrowserClient { // (Not called GetAcceptLanguages so it doesn't clash with win32). virtual std::string GetAcceptLangs(const TabContents* tab); + // Returns the default favicon. The callee doesn't own the given bitmap. + virtual SkBitmap* GetDefaultFavicon(); + // Allow the embedder to control if an AppCache can be used for the given url. // This is called on the IO thread. virtual bool AllowAppCache(const GURL& manifest_url, diff --git a/content/browser/speech/speech_recognition_request.cc b/content/browser/speech/speech_recognition_request.cc index 239d51b..1e9b24e 100644 --- a/content/browser/speech/speech_recognition_request.cc +++ b/content/browser/speech/speech_recognition_request.cc @@ -15,7 +15,6 @@ #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_getter.h" #include "net/url_request/url_request_status.h" -#include "ui/base/l10n/l10n_util.h" namespace { diff --git a/content/browser/tab_contents/navigation_controller.cc b/content/browser/tab_contents/navigation_controller.cc index 2455e3f..0d1a9ac 100644 --- a/content/browser/tab_contents/navigation_controller.cc +++ b/content/browser/tab_contents/navigation_controller.cc @@ -23,7 +23,6 @@ #include "content/common/navigation_types.h" #include "content/common/notification_service.h" #include "content/common/view_messages.h" -#include "grit/app_resources.h" #include "net/base/escape.h" #include "net/base/mime_util.h" #include "net/base/net_util.h" diff --git a/content/browser/tab_contents/navigation_entry.cc b/content/browser/tab_contents/navigation_entry.cc index 3fb5f79..a93a1fe 100644 --- a/content/browser/tab_contents/navigation_entry.cc +++ b/content/browser/tab_contents/navigation_entry.cc @@ -6,13 +6,11 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/profiles/profile.h" +#include "content/browser/content_browser_client.h" #include "content/browser/site_instance.h" #include "content/common/content_constants.h" #include "content/common/url_constants.h" -#include "grit/app_resources.h" #include "net/base/net_util.h" -#include "ui/base/resource/resource_bundle.h" #include "ui/base/text/text_elider.h" // Use this to get a new unique ID for a NavigationEntry during construction. @@ -32,8 +30,7 @@ NavigationEntry::SSLStatus::SSLStatus() } NavigationEntry::FaviconStatus::FaviconStatus() : valid_(false) { - ResourceBundle &rb = ResourceBundle::GetSharedInstance(); - bitmap_ = *rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); + bitmap_ = *content::GetContentClient()->browser()->GetDefaultFavicon(); } diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index 200d80f..e00e238 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -47,7 +47,6 @@ #include "net/base/registry_controlled_domain.h" #include "net/url_request/url_request_context_getter.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" -#include "ui/base/resource/resource_bundle.h" #include "ui/gfx/codec/png_codec.h" #include "webkit/glue/password_form.h" #include "webkit/glue/webpreferences.h" diff --git a/content/common/content_client.cc b/content/common/content_client.cc index 559b4b4..d903a58 100644 --- a/content/common/content_client.cc +++ b/content/common/content_client.cc @@ -4,6 +4,8 @@ #include "content/common/content_client.h" +#include "base/string_piece.h" + namespace content { static ContentClient* g_client; @@ -35,6 +37,15 @@ std::string ContentClient::GetUserAgent(bool mimic_windows) const { return std::string(); } +string16 ContentClient::GetLocalizedString(int message_id) const { + return string16(); +} + +// Return the contents of a resource in a StringPiece given the resource id. +base::StringPiece ContentClient::GetDataResource(int resource_id) const { + return base::StringPiece(); +} + #if defined(OS_WIN) bool ContentClient::SandboxPlugin(CommandLine* command_line, sandbox::TargetPolicy* policy) { diff --git a/content/common/content_client.h b/content/common/content_client.h index 9934411..7ca34b4 100644 --- a/content/common/content_client.h +++ b/content/common/content_client.h @@ -10,6 +10,7 @@ #include <vector> #include "base/basictypes.h" +#include "base/string16.h" #include "build/build_config.h" class CommandLine; @@ -21,6 +22,10 @@ namespace IPC { class Message; } +namespace base { +class StringPiece; +} + namespace sandbox { class TargetPolicy; } @@ -75,6 +80,12 @@ class ContentClient { // websites. virtual std::string GetUserAgent(bool mimic_windows) const; + // Returns a string resource given its id. + virtual string16 GetLocalizedString(int message_id) const; + + // Return the contents of a resource in a StringPiece given the resource id. + virtual base::StringPiece GetDataResource(int resource_id) const; + #if defined(OS_WIN) // Allows the embedder to sandbox a plugin, and apply a custom policy. virtual bool SandboxPlugin(CommandLine* command_line, diff --git a/content/renderer/renderer_glue.cc b/content/renderer/renderer_glue.cc index 91a1078..31e9cf4 100644 --- a/content/renderer/renderer_glue.cc +++ b/content/renderer/renderer_glue.cc @@ -30,8 +30,6 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/clipboard/clipboard.h" -#include "ui/base/l10n/l10n_util.h" -#include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_switches.h" #include "webkit/glue/scoped_clipboard_writer_glue.h" #include "webkit/glue/webkit_glue.h" @@ -121,16 +119,6 @@ ScopedClipboardWriterGlue::~ScopedClipboardWriterGlue() { namespace webkit_glue { -base::StringPiece GetDataResource(int resource_id) { - return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); -} - -#if defined(OS_WIN) -HCURSOR LoadCursor(int cursor_id) { - return ResourceBundle::GetSharedInstance().LoadCursor(cursor_id); -} -#endif - // Clipboard glue ui::Clipboard* ClipboardGetClipboard() { @@ -285,11 +273,12 @@ std::string GetWebKitLocale() { return lang; } -// TODO(ananta) -// We should probably ask the embedder(chrome) for resources like strings, etc. -// http://code.google.com/p/chromium/issues/detail?id=85757 string16 GetLocalizedString(int message_id) { - return l10n_util::GetStringUTF16(message_id); + return content::GetContentClient()->GetLocalizedString(message_id); +} + +base::StringPiece GetDataResource(int resource_id) { + return content::GetContentClient()->GetDataResource(resource_id); } std::string BuildUserAgent(bool mimic_windows) { |