OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/about_ui.h" | 5 #include "chrome/browser/ui/webui/about_ui.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // ChromeOSAboutVersionHandler is responsible for loading the Chrome OS | 155 // ChromeOSAboutVersionHandler is responsible for loading the Chrome OS |
156 // version. | 156 // version. |
157 // ChromeOSAboutVersionHandler handles deleting itself once the version has | 157 // ChromeOSAboutVersionHandler handles deleting itself once the version has |
158 // been obtained and AboutUIHTMLSource notified. | 158 // been obtained and AboutUIHTMLSource notified. |
159 class ChromeOSAboutVersionHandler { | 159 class ChromeOSAboutVersionHandler { |
160 public: | 160 public: |
161 ChromeOSAboutVersionHandler(AboutUIHTMLSource* source, int request_id); | 161 ChromeOSAboutVersionHandler(AboutUIHTMLSource* source, int request_id); |
162 | 162 |
163 // Callback from chromeos::VersionLoader giving the version. | 163 // Callback from chromeos::VersionLoader giving the version. |
164 void OnVersion(chromeos::VersionLoader::Handle handle, | 164 void OnVersion(chromeos::VersionLoader::Handle handle, |
165 std::string version); | 165 const std::string& version); |
166 | 166 |
167 private: | 167 private: |
168 // Where the results are fed to. | 168 // Where the results are fed to. |
169 scoped_refptr<AboutUIHTMLSource> source_; | 169 scoped_refptr<AboutUIHTMLSource> source_; |
170 | 170 |
171 // ID identifying the request. | 171 // ID identifying the request. |
172 int request_id_; | 172 int request_id_; |
173 | 173 |
174 // Handles asynchronously loading the version. | 174 // Handles asynchronously loading the version. |
175 chromeos::VersionLoader loader_; | 175 chromeos::VersionLoader loader_; |
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1269 : source_(source), | 1269 : source_(source), |
1270 request_id_(request_id) { | 1270 request_id_(request_id) { |
1271 loader_.GetVersion(&consumer_, | 1271 loader_.GetVersion(&consumer_, |
1272 base::Bind(&ChromeOSAboutVersionHandler::OnVersion, | 1272 base::Bind(&ChromeOSAboutVersionHandler::OnVersion, |
1273 base::Unretained(this)), | 1273 base::Unretained(this)), |
1274 chromeos::VersionLoader::VERSION_FULL); | 1274 chromeos::VersionLoader::VERSION_FULL); |
1275 } | 1275 } |
1276 | 1276 |
1277 void ChromeOSAboutVersionHandler::OnVersion( | 1277 void ChromeOSAboutVersionHandler::OnVersion( |
1278 chromeos::VersionLoader::Handle handle, | 1278 chromeos::VersionLoader::Handle handle, |
1279 std::string version) { | 1279 const std::string& version) { |
1280 DictionaryValue localized_strings; | 1280 DictionaryValue localized_strings; |
1281 localized_strings.SetString("os_version", version); | 1281 localized_strings.SetString("os_version", version); |
1282 source_->FinishDataRequest(AboutVersionStrings( | 1282 source_->FinishDataRequest(AboutVersionStrings( |
1283 &localized_strings, source_->profile()), request_id_); | 1283 &localized_strings, source_->profile()), request_id_); |
1284 | 1284 |
1285 // CancelableRequestProvider isn't happy when it's deleted and servicing a | 1285 // CancelableRequestProvider isn't happy when it's deleted and servicing a |
1286 // task, so we delay the deletion. | 1286 // task, so we delay the deletion. |
1287 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 1287 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
1288 } | 1288 } |
1289 | 1289 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1396 ThemeSource* theme = new ThemeSource(profile); | 1396 ThemeSource* theme = new ThemeSource(profile); |
1397 ChromeURLDataManager::AddDataSource(profile, theme); | 1397 ChromeURLDataManager::AddDataSource(profile, theme); |
1398 #endif | 1398 #endif |
1399 | 1399 |
1400 ChromeURLDataManager::DataSource* source = | 1400 ChromeURLDataManager::DataSource* source = |
1401 new AboutUIHTMLSource(name, profile); | 1401 new AboutUIHTMLSource(name, profile); |
1402 if (source) { | 1402 if (source) { |
1403 ChromeURLDataManager::AddDataSource(profile, source); | 1403 ChromeURLDataManager::AddDataSource(profile, source); |
1404 } | 1404 } |
1405 } | 1405 } |
OLD | NEW |