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

Side by Side Diff: chrome/browser/chromeos/login/version_info_updater.cc

Issue 8588006: Eliminate CrosLibrary::EnsureLoaded (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/login/user_manager.cc ('k') | chrome/browser/chromeos/sms_observer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/login/version_info_updater.h" 5 #include "chrome/browser/chromeos/login/version_info_updater.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/string16.h" 12 #include "base/string16.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/stringprintf.h" 14 #include "base/stringprintf.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/chromeos/cros/cros_library.h" 17 #include "chrome/browser/chromeos/cros/cros_library.h"
18 #include "chrome/browser/chromeos/system/runtime_environment.h"
18 #include "chrome/browser/policy/browser_policy_connector.h" 19 #include "chrome/browser/policy/browser_policy_connector.h"
19 #include "chrome/browser/profiles/profile_manager.h" 20 #include "chrome/browser/profiles/profile_manager.h"
20 #include "chrome/common/chrome_version_info.h" 21 #include "chrome/common/chrome_version_info.h"
21 #include "googleurl/src/gurl.h" 22 #include "googleurl/src/gurl.h"
22 #include "grit/chromium_strings.h" 23 #include "grit/chromium_strings.h"
23 #include "grit/generated_resources.h" 24 #include "grit/generated_resources.h"
24 #include "grit/theme_resources.h" 25 #include "grit/theme_resources.h"
25 #include "third_party/cros_system_api/window_manager/chromeos_wm_ipc_enums.h" 26 #include "third_party/cros_system_api/window_manager/chromeos_wm_ipc_enums.h"
26 #include "ui/base/l10n/l10n_util.h" 27 #include "ui/base/l10n/l10n_util.h"
27 #include "ui/base/resource/resource_bundle.h" 28 #include "ui/base/resource/resource_bundle.h"
28 29
29 #if defined(TOOLKIT_USES_GTK) 30 #if defined(TOOLKIT_USES_GTK)
30 #include "chrome/browser/chromeos/legacy_window_manager/wm_ipc.h" 31 #include "chrome/browser/chromeos/legacy_window_manager/wm_ipc.h"
31 #endif 32 #endif
32 33
33 namespace chromeos { 34 namespace chromeos {
34 35
35 /////////////////////////////////////////////////////////////////////////////// 36 ///////////////////////////////////////////////////////////////////////////////
36 // VersionInfoUpdater public: 37 // VersionInfoUpdater public:
37 38
38 VersionInfoUpdater::VersionInfoUpdater(Delegate* delegate) 39 VersionInfoUpdater::VersionInfoUpdater(Delegate* delegate)
39 : delegate_(delegate) { 40 : delegate_(delegate) {
40 } 41 }
41 42
42 VersionInfoUpdater::~VersionInfoUpdater() { 43 VersionInfoUpdater::~VersionInfoUpdater() {
43 } 44 }
44 45
45 void VersionInfoUpdater::StartUpdate(bool is_official_build) { 46 void VersionInfoUpdater::StartUpdate(bool is_official_build) {
46 if (CrosLibrary::Get()->EnsureLoaded()) { 47 if (system::runtime_environment::IsRunningOnChromeOS()) {
47 version_loader_.GetVersion( 48 version_loader_.GetVersion(
48 &version_consumer_, 49 &version_consumer_,
49 base::Bind(&VersionInfoUpdater::OnVersion, base::Unretained(this)), 50 base::Bind(&VersionInfoUpdater::OnVersion, base::Unretained(this)),
50 is_official_build ? 51 is_official_build ?
51 VersionLoader::VERSION_SHORT_WITH_DATE : 52 VersionLoader::VERSION_SHORT_WITH_DATE :
52 VersionLoader::VERSION_FULL); 53 VersionLoader::VERSION_FULL);
53 boot_times_loader_.GetBootTimes( 54 boot_times_loader_.GetBootTimes(
54 &boot_times_consumer_, 55 &boot_times_consumer_,
55 NewCallback(this, is_official_build ? 56 NewCallback(this, is_official_build ?
56 &VersionInfoUpdater::OnBootTimesNoop : 57 &VersionInfoUpdater::OnBootTimesNoop :
(...skipping 14 matching lines...) Expand all
71 new policy::CloudPolicySubsystem::ObserverRegistrar( 72 new policy::CloudPolicySubsystem::ObserverRegistrar(
72 cloud_policy, this)); 73 cloud_policy, this));
73 74
74 // Ensure that we have up-to-date enterprise info in case enterprise policy 75 // Ensure that we have up-to-date enterprise info in case enterprise policy
75 // is already fetched and has finished initialization. 76 // is already fetched and has finished initialization.
76 UpdateEnterpriseInfo(); 77 UpdateEnterpriseInfo();
77 } 78 }
78 } 79 }
79 80
80 void VersionInfoUpdater::UpdateVersionLabel() { 81 void VersionInfoUpdater::UpdateVersionLabel() {
81 if (!CrosLibrary::Get()->EnsureLoaded()) { 82 if (!system::runtime_environment::IsRunningOnChromeOS()) {
82 if (delegate_) { 83 if (delegate_) {
83 delegate_->OnOSVersionLabelTextUpdated( 84 delegate_->OnOSVersionLabelTextUpdated(
84 CrosLibrary::Get()->load_error_string()); 85 CrosLibrary::Get()->load_error_string());
85 } 86 }
86 return; 87 return;
87 } 88 }
88 89
89 if (version_text_.empty()) 90 if (version_text_.empty())
90 return; 91 return;
91 92
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 delegate_->OnBootTimesLabelTextUpdated(boot_times_text); 201 delegate_->OnBootTimesLabelTextUpdated(boot_times_text);
201 } 202 }
202 203
203 void VersionInfoUpdater::OnPolicyStateChanged( 204 void VersionInfoUpdater::OnPolicyStateChanged(
204 policy::CloudPolicySubsystem::PolicySubsystemState state, 205 policy::CloudPolicySubsystem::PolicySubsystemState state,
205 policy::CloudPolicySubsystem::ErrorDetails error_details) { 206 policy::CloudPolicySubsystem::ErrorDetails error_details) {
206 UpdateEnterpriseInfo(); 207 UpdateEnterpriseInfo();
207 } 208 }
208 209
209 } // namespace chromeos 210 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_manager.cc ('k') | chrome/browser/chromeos/sms_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698