Commit b63e3be0 authored by jvoung@chromium.org's avatar jvoung@chromium.org

Remove pnacl_profile_observer from pnacl's use of component updater.

It was previously used for per-profile ChromeOS component
installation, and then changed to do cleanup from that
experiment. The files should be cleaned up by now, so remove that code.

Stop registering PNaCl for component updates on ChromeOS
also, since that was just for the cleanup.

Eventually should move to using the default component
installer w/ customization through traits, then we can
get rid of the browser_process field.

BUG=none

Review URL: https://codereview.chromium.org/338403002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277898 0039d316-1c4b-4281-b951-d872f2087c98
parent 7edbd4bf
...@@ -387,14 +387,8 @@ void RegisterComponentsForUpdate(const CommandLine& command_line) { ...@@ -387,14 +387,8 @@ void RegisterComponentsForUpdate(const CommandLine& command_line) {
RegisterRecoveryComponent(cus, g_browser_process->local_state()); RegisterRecoveryComponent(cus, g_browser_process->local_state());
RegisterPepperFlashComponent(cus); RegisterPepperFlashComponent(cus);
RegisterSwiftShaderComponent(cus); RegisterSwiftShaderComponent(cus);
#endif
#if !defined(OS_ANDROID)
g_browser_process->pnacl_component_installer()->RegisterPnaclComponent( g_browser_process->pnacl_component_installer()->RegisterPnaclComponent(
cus, command_line); cus, command_line);
#endif
#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
RegisterWidevineCdmComponent(cus); RegisterWidevineCdmComponent(cus);
#endif #endif
......
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/component_updater/component_updater_service.h" #include "chrome/browser/component_updater/component_updater_service.h"
#include "chrome/browser/omaha_query_params/omaha_query_params.h" #include "chrome/browser/omaha_query_params/omaha_query_params.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
#include "components/nacl/common/nacl_switches.h" #include "components/nacl/common/nacl_switches.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
...@@ -206,10 +204,7 @@ bool CheckPnaclComponentManifest(const base::DictionaryValue& manifest, ...@@ -206,10 +204,7 @@ bool CheckPnaclComponentManifest(const base::DictionaryValue& manifest,
} // namespace } // namespace
PnaclComponentInstaller::PnaclComponentInstaller() PnaclComponentInstaller::PnaclComponentInstaller()
: per_user_(false), updates_disabled_(false), cus_(NULL) { : updates_disabled_(false), cus_(NULL) {
#if defined(OS_CHROMEOS)
per_user_ = true;
#endif
} }
PnaclComponentInstaller::~PnaclComponentInstaller() { PnaclComponentInstaller::~PnaclComponentInstaller() {
...@@ -224,31 +219,9 @@ void PnaclComponentInstaller::OnUpdateError(int error) { ...@@ -224,31 +219,9 @@ void PnaclComponentInstaller::OnUpdateError(int error) {
// and the base directory will be: // and the base directory will be:
// <profile>\AppData\Local\Google\Chrome\User Data\pnacl\. // <profile>\AppData\Local\Google\Chrome\User Data\pnacl\.
base::FilePath PnaclComponentInstaller::GetPnaclBaseDirectory() { base::FilePath PnaclComponentInstaller::GetPnaclBaseDirectory() {
// For ChromeOS, temporarily make this user-dependent (for integrity) until base::FilePath result;
// we find a better solution. CHECK(PathService::Get(chrome::DIR_PNACL_BASE, &result));
// This is not ideal because of the following: return result;
// (a) We end up with per-user copies instead of a single copy
// (b) The profile can change as users log in to different accounts
// so we need to watch for user-login-events (see pnacl_profile_observer.h).
if (per_user_) {
DCHECK(!current_profile_path_.empty());
base::FilePath path =
current_profile_path_.Append(FILE_PATH_LITERAL("pnacl"));
return path;
} else {
base::FilePath result;
CHECK(PathService::Get(chrome::DIR_PNACL_BASE, &result));
return result;
}
}
void PnaclComponentInstaller::OnProfileChange() {
// On chromeos, we want to find the --login-profile=<foo> dir.
// Even though the path does vary between users, the content
// changes when logging out and logging in.
ProfileManager* pm = g_browser_process->profile_manager();
current_profile_path_ =
pm->user_data_dir().Append(pm->GetInitialProfileDir());
} }
bool PnaclComponentInstaller::Install(const base::DictionaryValue& manifest, bool PnaclComponentInstaller::Install(const base::DictionaryValue& manifest,
...@@ -394,37 +367,6 @@ void StartPnaclUpdateRegistration(PnaclComponentInstaller* pci) { ...@@ -394,37 +367,6 @@ void StartPnaclUpdateRegistration(PnaclComponentInstaller* pci) {
} }
} }
// Remove old per-profile copies of PNaCl (was for ChromeOS).
// TODO(jvoung): Delete this code once most ChromeOS users have reaped
// their old per-profile copies of PNaCl.
void ReapOldChromeOSPnaclFiles(PnaclComponentInstaller* pci) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
base::FilePath path = pci->GetPnaclBaseDirectory();
if (!base::PathExists(path))
return;
// Do a basic sanity check first.
if (pci->per_user() &&
path.BaseName().value().compare(FILE_PATH_LITERAL("pnacl")) == 0)
base::DeleteFile(path, true);
}
void GetProfileInformation(PnaclComponentInstaller* pci) {
// Bail if not logged in yet.
if (!g_browser_process->profile_manager()->IsLoggedIn()) {
return;
}
pci->OnProfileChange();
// Do not actually register PNaCl for component updates, for CHROMEOS.
// Just get the profile information and delete the per-profile files
// if they exist.
BrowserThread::PostTask(BrowserThread::FILE,
FROM_HERE,
base::Bind(&ReapOldChromeOSPnaclFiles, pci));
}
} // namespace } // namespace
void PnaclComponentInstaller::RegisterPnaclComponent( void PnaclComponentInstaller::RegisterPnaclComponent(
...@@ -433,27 +375,9 @@ void PnaclComponentInstaller::RegisterPnaclComponent( ...@@ -433,27 +375,9 @@ void PnaclComponentInstaller::RegisterPnaclComponent(
// Register PNaCl by default (can be disabled). // Register PNaCl by default (can be disabled).
updates_disabled_ = command_line.HasSwitch(switches::kDisablePnaclInstall); updates_disabled_ = command_line.HasSwitch(switches::kDisablePnaclInstall);
cus_ = cus; cus_ = cus;
// If per_user, create a profile observer to watch for logins. BrowserThread::PostTask(BrowserThread::FILE,
// Only do so after cus_ is set to something non-null. FROM_HERE,
if (per_user_ && !profile_observer_) { base::Bind(&StartPnaclUpdateRegistration, this));
profile_observer_.reset(new PnaclProfileObserver(this));
}
if (per_user_) {
// Figure out profile information, before proceeding to look for files.
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE, base::Bind(&GetProfileInformation, this));
} else {
BrowserThread::PostTask(BrowserThread::FILE,
FROM_HERE,
base::Bind(&StartPnaclUpdateRegistration, this));
}
}
void PnaclComponentInstaller::ReRegisterPnacl() {
DCHECK(per_user_);
// Figure out profile information, before proceeding to look for files.
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE, base::Bind(&GetProfileInformation, this));
} }
} // namespace component_updater } // namespace component_updater
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/version.h" #include "base/version.h"
#include "chrome/browser/component_updater/component_updater_service.h" #include "chrome/browser/component_updater/component_updater_service.h"
#include "chrome/browser/component_updater/pnacl/pnacl_profile_observer.h"
namespace base { namespace base {
class CommandLine; class CommandLine;
...@@ -54,18 +53,8 @@ class PnaclComponentInstaller : public ComponentInstaller { ...@@ -54,18 +53,8 @@ class PnaclComponentInstaller : public ComponentInstaller {
void RegisterPnaclComponent(ComponentUpdateService* cus, void RegisterPnaclComponent(ComponentUpdateService* cus,
const base::CommandLine& command_line); const base::CommandLine& command_line);
// Check the PNaCl version again and re-register with the component
// updater service.
void ReRegisterPnacl();
CrxComponent GetCrxComponent(); CrxComponent GetCrxComponent();
// Return true if PNaCl installs are separated by user.
bool per_user() const { return per_user_; }
// If per_user, function to call when profile is changed.
void OnProfileChange();
// Return true if PNaCl updates are disabled. // Return true if PNaCl updates are disabled.
bool updates_disabled() const { return updates_disabled_; } bool updates_disabled() const { return updates_disabled_; }
...@@ -87,10 +76,7 @@ class PnaclComponentInstaller : public ComponentInstaller { ...@@ -87,10 +76,7 @@ class PnaclComponentInstaller : public ComponentInstaller {
ComponentUpdateService* cus() const { return cus_; } ComponentUpdateService* cus() const { return cus_; }
private: private:
bool per_user_;
bool updates_disabled_; bool updates_disabled_;
scoped_ptr<PnaclProfileObserver> profile_observer_;
base::FilePath current_profile_path_;
base::Version current_version_; base::Version current_version_;
std::string current_fingerprint_; std::string current_fingerprint_;
ComponentUpdateService* cus_; ComponentUpdateService* cus_;
......
// Copyright (c) 2013 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/component_updater/pnacl/pnacl_profile_observer.h"
#include "base/logging.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h"
#include "content/public/browser/notification_service.h"
namespace component_updater {
PnaclProfileObserver::PnaclProfileObserver(PnaclComponentInstaller* installer)
: pnacl_installer_(installer) {
// We only need to observe NOTIFICATION_LOGIN_USER_CHANGED for ChromeOS
// (and it's only defined for ChromeOS).
#if defined(OS_CHROMEOS)
registrar_.Add(this,
chrome::NOTIFICATION_LOGIN_USER_CHANGED,
content::NotificationService::AllSources());
#endif
}
PnaclProfileObserver::~PnaclProfileObserver() {
}
void PnaclProfileObserver::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
#if defined(OS_CHROMEOS)
if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED) {
pnacl_installer_->ReRegisterPnacl();
return;
}
NOTREACHED() << "Unexpected notification observed";
#endif
}
} // namespace component_updater
// Copyright (c) 2013 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_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_PROFILE_OBSERVER_H_
#define CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_PROFILE_OBSERVER_H_
#include "base/compiler_specific.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
namespace component_updater {
class PnaclComponentInstaller;
// Monitors profile switching for ChromeOS to check the per-user
// version of PNaCl.
class PnaclProfileObserver : public content::NotificationObserver {
public:
explicit PnaclProfileObserver(PnaclComponentInstaller* installer);
virtual ~PnaclProfileObserver();
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
private:
content::NotificationRegistrar registrar_;
PnaclComponentInstaller* pnacl_installer_;
DISALLOW_COPY_AND_ASSIGN(PnaclProfileObserver);
};
} // namespace component_updater
#endif // CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_PROFILE_OBSERVER_H_
...@@ -463,8 +463,6 @@ ...@@ -463,8 +463,6 @@
'browser/component_updater/pepper_flash_component_installer.cc', 'browser/component_updater/pepper_flash_component_installer.cc',
'browser/component_updater/pnacl/pnacl_component_installer.cc', 'browser/component_updater/pnacl/pnacl_component_installer.cc',
'browser/component_updater/pnacl/pnacl_component_installer.h', 'browser/component_updater/pnacl/pnacl_component_installer.h',
'browser/component_updater/pnacl/pnacl_profile_observer.cc',
'browser/component_updater/pnacl/pnacl_profile_observer.h',
'browser/component_updater/ppapi_utils.cc', 'browser/component_updater/ppapi_utils.cc',
'browser/component_updater/ppapi_utils.h', 'browser/component_updater/ppapi_utils.h',
'browser/component_updater/recovery_component_installer.cc', 'browser/component_updater/recovery_component_installer.cc',
...@@ -3264,7 +3262,6 @@ ...@@ -3264,7 +3262,6 @@
'browser/chrome_browser_main_posix.cc', 'browser/chrome_browser_main_posix.cc',
'browser/chrome_browser_main_posix.h', 'browser/chrome_browser_main_posix.h',
'browser/chrome_process_singleton.cc', 'browser/chrome_process_singleton.cc',
'browser/component_updater/pnacl/pnacl_profile_observer.cc',
'browser/component_updater/widevine_cdm_component_installer.cc', 'browser/component_updater/widevine_cdm_component_installer.cc',
'browser/custom_home_pages_table_model.cc', 'browser/custom_home_pages_table_model.cc',
'browser/download/download_danger_prompt.cc', 'browser/download/download_danger_prompt.cc',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment