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

Unified Diff: chrome/browser/pepper_flash_settings_manager.cc

Issue 10690146: Fix PepperFlashSettingsManager::Core initialization. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/pepper_flash_settings_manager.cc
diff --git a/chrome/browser/pepper_flash_settings_manager.cc b/chrome/browser/pepper_flash_settings_manager.cc
index 2fa8ea9d83efd5e134c90dd2ace1e77588de0a53..e12cfb563f4b5d8d3a744d4ca177db12d330549a 100644
--- a/chrome/browser/pepper_flash_settings_manager.cc
+++ b/chrome/browser/pepper_flash_settings_manager.cc
@@ -36,6 +36,7 @@ class PepperFlashSettingsManager::Core
Core(PepperFlashSettingsManager* manager,
content::BrowserContext* browser_context);
+ void Initialize();
// Stops sending notifications to |manager_| and sets it to NULL.
void Detach();
@@ -94,9 +95,9 @@ class PepperFlashSettingsManager::Core
virtual ~Core();
- void Initialize();
void ConnectToChannel(bool success, const IPC::ChannelHandle& handle);
+ void InitializeOnIOThread();
void DeauthorizeContentLicensesOnIOThread(uint32 request_id);
void GetPermissionSettingsOnIOThread(
uint32 request_id,
@@ -179,15 +180,18 @@ PepperFlashSettingsManager::Core::Core(PepperFlashSettingsManager* manager,
plugin_prefs_(PluginPrefs::GetForProfile(
Profile::FromBrowserContext(browser_context))) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
- base::Bind(&Core::Initialize, this));
}
PepperFlashSettingsManager::Core::~Core() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
}
+void PepperFlashSettingsManager::Core::Initialize() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
+ base::Bind(&Core::InitializeOnIOThread, this));
+}
+
void PepperFlashSettingsManager::Core::Detach() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -272,32 +276,6 @@ void PepperFlashSettingsManager::Core::OnChannelError() {
NotifyErrorFromIOThread();
}
-void PepperFlashSettingsManager::Core::Initialize() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- DCHECK(!detached_);
- DCHECK(!initialized_);
-
- webkit::WebPluginInfo plugin_info;
- if (!PepperFlashSettingsManager::IsPepperFlashInUse(plugin_prefs_.get(),
- &plugin_info)) {
- NotifyErrorFromIOThread();
- return;
- }
-
- FilePath profile_path =
- browser_context_path_.Append(content::kPepperDataDirname);
-#if defined(OS_WIN)
- plugin_data_path_ = profile_path.Append(plugin_info.name);
-#else
- plugin_data_path_ = profile_path.Append(UTF16ToUTF8(plugin_info.name));
-#endif
-
- helper_ = content::PepperFlashSettingsHelper::Create();
- content::PepperFlashSettingsHelper::OpenChannelCallback callback =
- base::Bind(&Core::ConnectToChannel, this);
- helper_->OpenChannelToBroker(plugin_info.path, callback);
-}
-
void PepperFlashSettingsManager::Core::ConnectToChannel(
bool success,
const IPC::ChannelHandle& handle) {
@@ -350,6 +328,34 @@ void PepperFlashSettingsManager::Core::ConnectToChannel(
}
}
+void PepperFlashSettingsManager::Core::InitializeOnIOThread() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK(!initialized_);
+
+ if (detached_)
+ return;
+
+ webkit::WebPluginInfo plugin_info;
+ if (!PepperFlashSettingsManager::IsPepperFlashInUse(plugin_prefs_.get(),
+ &plugin_info)) {
+ NotifyErrorFromIOThread();
+ return;
+ }
+
+ FilePath profile_path =
+ browser_context_path_.Append(content::kPepperDataDirname);
+#if defined(OS_WIN)
+ plugin_data_path_ = profile_path.Append(plugin_info.name);
+#else
+ plugin_data_path_ = profile_path.Append(UTF16ToUTF8(plugin_info.name));
+#endif
+
+ helper_ = content::PepperFlashSettingsHelper::Create();
+ content::PepperFlashSettingsHelper::OpenChannelCallback callback =
+ base::Bind(&Core::ConnectToChannel, this);
+ helper_->OpenChannelToBroker(plugin_info.path, callback);
+}
+
void PepperFlashSettingsManager::Core::DeauthorizeContentLicensesOnIOThread(
uint32 request_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
@@ -764,8 +770,10 @@ uint32 PepperFlashSettingsManager::GetNextRequestId() {
}
void PepperFlashSettingsManager::EnsureCoreExists() {
- if (!core_.get())
+ if (!core_.get()) {
core_ = new Core(this, browser_context_);
+ core_->Initialize();
+ }
}
void PepperFlashSettingsManager::OnError() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698