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

Unified Diff: chrome/browser/chromeos/login/session_manager_observer.cc

Issue 10824112: Move Chrome OS device settings stuff to chrome/browser/chromeos/settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. 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
Index: chrome/browser/chromeos/login/session_manager_observer.cc
diff --git a/chrome/browser/chromeos/login/session_manager_observer.cc b/chrome/browser/chromeos/login/session_manager_observer.cc
deleted file mode 100644
index fa4b66c45d5ba143488cfb70afa584936799cc1c..0000000000000000000000000000000000000000
--- a/chrome/browser/chromeos/login/session_manager_observer.cc
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright (c) 2012 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/chromeos/login/session_manager_observer.h"
-
-#include "chrome/browser/browser_process.h"
-#include "chrome/browser/chromeos/login/signed_settings.h"
-#include "chrome/browser/chromeos/login/signed_settings_cache.h"
-#include "chrome/common/chrome_notification_types.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/notification_service.h"
-
-namespace chromeos {
-
-namespace {
-
-class StubDelegate
- : public SignedSettings::Delegate<
- const enterprise_management::PolicyFetchResponse&> {
- public:
- StubDelegate() : policy_fetcher_(NULL) {}
- virtual ~StubDelegate() {}
-
- void set_fetcher(SignedSettings* fetcher) { policy_fetcher_ = fetcher; }
- SignedSettings* fetcher() { return policy_fetcher_.get(); }
-
- // Implementation of SignedSettings::Delegate
- virtual void OnSettingsOpCompleted(
- SignedSettings::ReturnCode code,
- const enterprise_management::PolicyFetchResponse& value) {
- VLOG(1) << "Done Fetching Policy";
- delete this;
- }
-
- private:
- scoped_refptr<SignedSettings> policy_fetcher_;
- DISALLOW_COPY_AND_ASSIGN(StubDelegate);
-};
-
-} // namespace
-
-SessionManagerObserver::SessionManagerObserver() {
- DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this);
-}
-
-SessionManagerObserver::~SessionManagerObserver() {
- DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this);
-}
-
-void SessionManagerObserver::OwnerKeySet(bool success) {
- VLOG(1) << "Owner key generation: " << (success ? "success" : "fail");
- int result =
- chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED;
- if (!success)
- result = chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_FAILED;
-
- // We stored some settings in transient storage before owner was assigned.
- // Now owner is assigned and key is generated and we should persist
- // those settings into signed storage.
- if (success && g_browser_process && g_browser_process->local_state())
- signed_settings_cache::Finalize(g_browser_process->local_state());
-
- // Whether we exported the public key or not, send a notification
- // indicating that we're done with this attempt.
- content::NotificationService::current()->Notify(
- result,
- content::NotificationService::AllSources(),
- content::NotificationService::NoDetails());
-}
-
-void SessionManagerObserver::PropertyChangeComplete(bool success) {
- if (success) {
- StubDelegate* stub = new StubDelegate(); // Manages its own lifetime.
- stub->set_fetcher(SignedSettings::CreateRetrievePolicyOp(stub));
- stub->fetcher()->Execute();
- }
-}
-
-} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/login/session_manager_observer.h ('k') | chrome/browser/chromeos/login/signed_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698