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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 13409003: Hide ContentClient getters from embedders so that they they don't reuse content's embedder API. The… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chrome_content_browser_client.h ('k') | chrome/browser/chromeos/login/login_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_content_browser_client.cc
===================================================================
--- chrome/browser/chrome_content_browser_client.cc (revision 192622)
+++ chrome/browser/chrome_content_browser_client.cc (working copy)
@@ -10,6 +10,7 @@
#include "base/bind.h"
#include "base/command_line.h"
+#include "base/lazy_instance.h"
#include "base/path_service.h"
#include "base/prefs/pref_service.h"
#include "base/strings/string_tokenizer.h"
@@ -180,6 +181,10 @@
namespace {
+// Cached version of the locale so we can return the locale on the I/O
+// thread.
+base::LazyInstance<std::string> g_io_thread_application_locale;
+
const char* kPredefinedAllowedSocketOrigins[] = {
"okddffdblfhhnmhodogpojmfkjmhinfp", // Test SSH Client
"pnhechapfaindjhompbnflcldabbghjo", // HTerm App (SSH Client)
@@ -461,6 +466,11 @@
return effective_url;
}
+void SetApplicationLocaleOnIOThread(const std::string& locale) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ g_io_thread_application_locale.Get() = locale;
+}
+
} // namespace
namespace chrome {
@@ -487,6 +497,25 @@
PrefRegistrySyncable::UNSYNCABLE_PREF);
}
+// static
+void ChromeContentBrowserClient::SetApplicationLocale(
+ const std::string& locale) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ // This object is guaranteed to outlive all threads so we don't have to
+ // worry about the lack of refcounting and can just post as Unretained.
+ //
+ // The common case is that this function is called early in Chrome startup
+ // before any threads are created (it will also be called later if the user
+ // changes the pref). In this case, there will be no threads created and
+ // posting will fail. When there are no threads, we can just set the string
+ // without worrying about threadsafety.
+ if (!BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
+ base::Bind(&SetApplicationLocaleOnIOThread, locale))) {
+ g_io_thread_application_locale.Get() = locale;
+ }
+}
+
content::BrowserMainParts* ChromeContentBrowserClient::CreateBrowserMainParts(
const content::MainFunctionParams& parameters) {
ChromeBrowserMainParts* main_parts;
@@ -1263,7 +1292,7 @@
std::string ChromeContentBrowserClient::GetApplicationLocale() {
if (BrowserThread::CurrentlyOn(BrowserThread::IO))
- return io_thread_application_locale_;
+ return g_io_thread_application_locale.Get();
return g_browser_process->GetApplicationLocale();
}
@@ -1901,13 +1930,6 @@
Value::CreateStringValue(value));
}
-void ChromeContentBrowserClient::ClearInspectorSettings(RenderViewHost* rvh) {
- content::BrowserContext* browser_context =
- rvh->GetProcess()->GetBrowserContext();
- Profile::FromBrowserContext(browser_context)->GetPrefs()->
- ClearPref(prefs::kWebKitInspectorSettings);
-}
-
void ChromeContentBrowserClient::BrowserURLHandlerCreated(
BrowserURLHandler* handler) {
// Add the default URL handlers.
@@ -2167,29 +2189,4 @@
}
#endif
-void ChromeContentBrowserClient::SetApplicationLocale(
- const std::string& locale) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- // This object is guaranteed to outlive all threads so we don't have to
- // worry about the lack of refcounting and can just post as Unretained.
- //
- // The common case is that this function is called early in Chrome startup
- // before any threads are created (it will also be called later if the user
- // changes the pref). In this case, there will be no threads created and
- // posting will fail. When there are no threads, we can just set the string
- // without worrying about threadsafety.
- if (!BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
- base::Bind(
- &ChromeContentBrowserClient::SetApplicationLocaleOnIOThread,
- base::Unretained(this), locale)))
- io_thread_application_locale_ = locale;
-}
-
-void ChromeContentBrowserClient::SetApplicationLocaleOnIOThread(
- const std::string& locale) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- io_thread_application_locale_ = locale;
-}
-
} // namespace chrome
« no previous file with comments | « chrome/browser/chrome_content_browser_client.h ('k') | chrome/browser/chromeos/login/login_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698