| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/browser_about_handler.h" | 5 #include "chrome/browser/browser_about_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "grit/locale_settings.h" | 45 #include "grit/locale_settings.h" |
| 46 #include "webkit/glue/webkit_glue.h" | 46 #include "webkit/glue/webkit_glue.h" |
| 47 #ifdef CHROME_V8 | 47 #ifdef CHROME_V8 |
| 48 #include "v8/include/v8.h" | 48 #include "v8/include/v8.h" |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 #if defined(OS_WIN) | 51 #if defined(OS_WIN) |
| 52 #include "chrome/browser/views/about_ipc_dialog.h" | 52 #include "chrome/browser/views/about_ipc_dialog.h" |
| 53 #include "chrome/browser/views/about_network_dialog.h" | 53 #include "chrome/browser/views/about_network_dialog.h" |
| 54 #elif defined(OS_CHROMEOS) | 54 #elif defined(OS_CHROMEOS) |
| 55 #include "chrome/browser/chromeos/chromeos_version_loader.h" | 55 #include "chrome/browser/chromeos/version_loader.h" |
| 56 #elif defined(OS_MACOSX) | 56 #elif defined(OS_MACOSX) |
| 57 #include "chrome/browser/cocoa/about_ipc_dialog.h" | 57 #include "chrome/browser/cocoa/about_ipc_dialog.h" |
| 58 #endif | 58 #endif |
| 59 | 59 |
| 60 #if defined(USE_TCMALLOC) | 60 #if defined(USE_TCMALLOC) |
| 61 #include "third_party/tcmalloc/tcmalloc/src/google/malloc_extension.h" | 61 #include "third_party/tcmalloc/tcmalloc/src/google/malloc_extension.h" |
| 62 #endif | 62 #endif |
| 63 | 63 |
| 64 using sync_api::SyncManager; | 64 using sync_api::SyncManager; |
| 65 | 65 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 149 |
| 150 #if defined(OS_CHROMEOS) | 150 #if defined(OS_CHROMEOS) |
| 151 // ChromeOSAboutVersionHandler is responsible for loading the Chrome OS | 151 // ChromeOSAboutVersionHandler is responsible for loading the Chrome OS |
| 152 // version. | 152 // version. |
| 153 // ChromeOSAboutVersionHandler handles deleting itself once the version has | 153 // ChromeOSAboutVersionHandler handles deleting itself once the version has |
| 154 // been obtained and AboutSource notified. | 154 // been obtained and AboutSource notified. |
| 155 class ChromeOSAboutVersionHandler { | 155 class ChromeOSAboutVersionHandler { |
| 156 public: | 156 public: |
| 157 ChromeOSAboutVersionHandler(AboutSource* source, int request_id); | 157 ChromeOSAboutVersionHandler(AboutSource* source, int request_id); |
| 158 | 158 |
| 159 // Callback from ChromeOSVersionLoader giving the version. | 159 // Callback from chromeos::VersionLoader giving the version. |
| 160 void OnVersion(ChromeOSVersionLoader::Handle handle, | 160 void OnVersion(chromeos::VersionLoader::Handle handle, |
| 161 std::string version); | 161 std::string version); |
| 162 | 162 |
| 163 private: | 163 private: |
| 164 // Where the results are fed to. | 164 // Where the results are fed to. |
| 165 scoped_refptr<AboutSource> source_; | 165 scoped_refptr<AboutSource> source_; |
| 166 | 166 |
| 167 // ID identifying the request. | 167 // ID identifying the request. |
| 168 int request_id_; | 168 int request_id_; |
| 169 | 169 |
| 170 // Handles asynchronously loading the version. | 170 // Handles asynchronously loading the version. |
| 171 ChromeOSVersionLoader loader_; | 171 chromeos::VersionLoader loader_; |
| 172 | 172 |
| 173 // Used to request the version. | 173 // Used to request the version. |
| 174 CancelableRequestConsumer consumer_; | 174 CancelableRequestConsumer consumer_; |
| 175 | 175 |
| 176 DISALLOW_COPY_AND_ASSIGN(ChromeOSAboutVersionHandler); | 176 DISALLOW_COPY_AND_ASSIGN(ChromeOSAboutVersionHandler); |
| 177 }; | 177 }; |
| 178 #endif | 178 #endif |
| 179 | 179 |
| 180 // Individual about handlers --------------------------------------------------- | 180 // Individual about handlers --------------------------------------------------- |
| 181 | 181 |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 | 768 |
| 769 ChromeOSAboutVersionHandler::ChromeOSAboutVersionHandler(AboutSource* source, | 769 ChromeOSAboutVersionHandler::ChromeOSAboutVersionHandler(AboutSource* source, |
| 770 int request_id) | 770 int request_id) |
| 771 : source_(source), | 771 : source_(source), |
| 772 request_id_(request_id) { | 772 request_id_(request_id) { |
| 773 loader_.GetVersion(&consumer_, | 773 loader_.GetVersion(&consumer_, |
| 774 NewCallback(this, &ChromeOSAboutVersionHandler::OnVersion)); | 774 NewCallback(this, &ChromeOSAboutVersionHandler::OnVersion)); |
| 775 } | 775 } |
| 776 | 776 |
| 777 void ChromeOSAboutVersionHandler::OnVersion( | 777 void ChromeOSAboutVersionHandler::OnVersion( |
| 778 ChromeOSVersionLoader::Handle handle, | 778 chromeos::VersionLoader::Handle handle, |
| 779 std::string version) { | 779 std::string version) { |
| 780 DictionaryValue localized_strings; | 780 DictionaryValue localized_strings; |
| 781 localized_strings.SetString(L"os_name", | 781 localized_strings.SetString(L"os_name", |
| 782 l10n_util::GetString(IDS_PRODUCT_OS_NAME)); | 782 l10n_util::GetString(IDS_PRODUCT_OS_NAME)); |
| 783 localized_strings.SetString(L"os_version", UTF8ToWide(version)); | 783 localized_strings.SetString(L"os_version", UTF8ToWide(version)); |
| 784 localized_strings.SetBoolean(L"is_chrome_os", true); | 784 localized_strings.SetBoolean(L"is_chrome_os", true); |
| 785 source_->FinishDataRequest(AboutVersion(&localized_strings), request_id_); | 785 source_->FinishDataRequest(AboutVersion(&localized_strings), request_id_); |
| 786 | 786 |
| 787 // CancelableRequestProvider isn't happy when it's deleted and servicing a | 787 // CancelableRequestProvider isn't happy when it's deleted and servicing a |
| 788 // task, so we delay the deletion. | 788 // task, so we delay the deletion. |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 // Run the dialog. This will re-use the existing one if it's already up. | 894 // Run the dialog. This will re-use the existing one if it's already up. |
| 895 AboutIPCDialog::RunDialog(); | 895 AboutIPCDialog::RunDialog(); |
| 896 return true; | 896 return true; |
| 897 } | 897 } |
| 898 #endif | 898 #endif |
| 899 | 899 |
| 900 #endif // OFFICIAL_BUILD | 900 #endif // OFFICIAL_BUILD |
| 901 | 901 |
| 902 return false; | 902 return false; |
| 903 } | 903 } |
| OLD | NEW |