diff options
author | benm@chromium.org <benm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-06 17:37:35 +0000 |
---|---|---|
committer | benm@chromium.org <benm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-06 17:37:35 +0000 |
commit | 17237f16eb340cabca2df6d39ea83a9167ffc3c3 (patch) | |
tree | d5a402f21cb659b2564a922b46f22da54c802188 /android_webview/browser | |
parent | 199af65ee52e4e9893df4c43dcf27663a2366efd (diff) | |
download | chromium_src-17237f16eb340cabca2df6d39ea83a9167ffc3c3.zip chromium_src-17237f16eb340cabca2df6d39ea83a9167ffc3c3.tar.gz chromium_src-17237f16eb340cabca2df6d39ea83a9167ffc3c3.tar.bz2 |
[Android WebView] Add new chrome/-less pak dependency.
android_webview must not depend on the chrome/ layer, so
we want to remove the last dependencies we have for generating resource paks. Toward this, define a new android_webview pak that depends only on content/ resources.
A later change will remove the dependency on the paks that contain chrome/resources.
For now we use the same resources Content Shell does. It may be possible to trim this further, but seems like a good starting point.
Android only, Android bots green
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/11348326
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171522 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/browser')
-rw-r--r-- | android_webview/browser/aw_browser_main_parts.cc | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/android_webview/browser/aw_browser_main_parts.cc b/android_webview/browser/aw_browser_main_parts.cc index da84b58..3785fa3 100644 --- a/android_webview/browser/aw_browser_main_parts.cc +++ b/android_webview/browser/aw_browser_main_parts.cc @@ -7,6 +7,8 @@ #include "android_webview/browser/aw_browser_context.h" #include "android_webview/browser/aw_result_codes.h" #include "base/android/build_info.h" +#include "base/file_path.h" +#include "base/path_service.h" #include "content/public/browser/android/compositor.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/render_process_host.h" @@ -14,7 +16,9 @@ #include "content/public/common/result_codes.h" #include "net/android/network_change_notifier_factory_android.h" #include "net/base/network_change_notifier.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/base/ui_base_paths.h" namespace android_webview { @@ -45,11 +49,28 @@ void AwBrowserMainParts::PreEarlyInitialization() { int AwBrowserMainParts::PreCreateThreads() { browser_context_->InitializeBeforeThreadCreation(); - const std::string loaded_locale = - ui::ResourceBundle::InitSharedInstanceWithLocale( - content::GetContentClient()->browser()->GetApplicationLocale(), NULL); - if (loaded_locale.empty()) - return RESULT_CODE_MISSING_DATA; + + // Although we don't load a locale pak for Android WebView, we still + // need to initialise the resource bundle with a locale. + ui::ResourceBundle::InitSharedInstanceLocaleOnly( + content::GetContentClient()->browser()->GetApplicationLocale(), NULL); + + // TODO(benm): It would be nice to be able to take string resources from + // the Android framework for WebView, and rely on resource paks only + // for non-string assets. e.g. graphics (and might be nice in the + // long term to move them into the Android framwork too). Toward + // that, seed the ResourceBundle instance with a non-string, locale + // independant pak. Until we no longer rely on paks for strings, + // load an extra data pack separately that has the strings in it. + FilePath pak_path; + PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &pak_path); + ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( + pak_path.AppendASCII("android_webview_strings.pak"), + ui::SCALE_FACTOR_NONE); + ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( + pak_path.AppendASCII("android_webview.pak"), + ui::SCALE_FACTOR_NONE); + return content::RESULT_CODE_NORMAL_EXIT; } |