Chromium Code Reviews| 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 #ifndef CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_ | 6 #define CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | |
| 9 | 10 |
| 10 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 11 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/singleton.h" | 14 #include "base/memory/singleton.h" |
| 14 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
| 15 #include "base/values.h" | 16 #include "base/values.h" |
| 16 #include "net/url_request/url_fetcher_delegate.h" | 17 #include "net/url_request/url_fetcher_delegate.h" |
| 17 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 18 | 19 |
| 19 class PrefRegistrySimple; | 20 class PrefRegistrySimple; |
| 20 | 21 |
| 21 namespace base { | 22 namespace base { |
| 22 class DictionaryValue; | 23 class DictionaryValue; |
| 23 class FilePath; | 24 class FilePath; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace net { | 27 namespace net { |
| 27 class URLFetcher; | 28 class URLFetcher; |
| 28 } | 29 } |
| 29 | 30 |
| 31 // This test is in global namespace so it must be declared here. | |
| 32 class CrosLanguageOptionsHandlerTest_GetUILanguageListMulti_Test; | |
|
Nikita (slow)
2014/01/31 15:47:20
As discussed, these should be removed.
You can ju
Alexander Alekseev
2014/01/31 17:21:00
Done.
| |
| 33 class CrosLanguageOptionsHandlerTest_DISABLED_GetUILanguageListMulti_Test; | |
| 34 class CrosLanguageOptionsHandlerTest_FLAKY_GetUILanguageListMulti_Test; | |
| 35 | |
| 30 namespace chromeos { | 36 namespace chromeos { |
| 31 | 37 |
| 32 namespace system { | 38 namespace system { |
| 33 class StatisticsProvider; | 39 class StatisticsProvider; |
| 34 } // system | 40 } // system |
| 35 | 41 |
| 36 // Base class for OEM customization document classes. | 42 // Base class for OEM customization document classes. |
| 37 class CustomizationDocument { | 43 class CustomizationDocument { |
| 38 public: | 44 public: |
| 39 virtual ~CustomizationDocument(); | 45 virtual ~CustomizationDocument(); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 69 public: | 75 public: |
| 70 static StartupCustomizationDocument* GetInstance(); | 76 static StartupCustomizationDocument* GetInstance(); |
| 71 | 77 |
| 72 std::string GetHelpPage(const std::string& locale) const; | 78 std::string GetHelpPage(const std::string& locale) const; |
| 73 std::string GetEULAPage(const std::string& locale) const; | 79 std::string GetEULAPage(const std::string& locale) const; |
| 74 | 80 |
| 75 const std::string& registration_url() const { return registration_url_; } | 81 const std::string& registration_url() const { return registration_url_; } |
| 76 | 82 |
| 77 // These methods can be called even if !IsReady(), in this case VPD values | 83 // These methods can be called even if !IsReady(), in this case VPD values |
| 78 // will be returned. | 84 // will be returned. |
| 85 // | |
| 86 // Raw value of "initial_locale" like initial_locale="en-US,sv,da,fi,no" . | |
| 79 const std::string& initial_locale() const { return initial_locale_; } | 87 const std::string& initial_locale() const { return initial_locale_; } |
| 88 | |
| 89 // Vector of individual locale values. | |
| 90 const std::vector<std::string>& configured_locales() const; | |
| 91 | |
| 92 // Default locale value (first value in initial_locale list). | |
| 93 const std::string& initial_locale_default() const; | |
| 80 const std::string& initial_timezone() const { return initial_timezone_; } | 94 const std::string& initial_timezone() const { return initial_timezone_; } |
| 81 const std::string& keyboard_layout() const { return keyboard_layout_; } | 95 const std::string& keyboard_layout() const { return keyboard_layout_; } |
| 82 | 96 |
| 83 private: | 97 private: |
| 84 FRIEND_TEST_ALL_PREFIXES(StartupCustomizationDocumentTest, Basic); | 98 FRIEND_TEST_ALL_PREFIXES(StartupCustomizationDocumentTest, Basic); |
| 85 FRIEND_TEST_ALL_PREFIXES(StartupCustomizationDocumentTest, VPD); | 99 FRIEND_TEST_ALL_PREFIXES(StartupCustomizationDocumentTest, VPD); |
| 86 FRIEND_TEST_ALL_PREFIXES(StartupCustomizationDocumentTest, BadManifest); | 100 FRIEND_TEST_ALL_PREFIXES(StartupCustomizationDocumentTest, BadManifest); |
| 101 FRIEND_TEST_ALL_PREFIXES(ServicesCustomizationDocumentTest, MultiLanguage); | |
| 102 FRIEND_TEST_ALL_PREFIXES(::CrosLanguageOptionsHandlerTest, | |
| 103 GetUILanguageListMulti); | |
| 87 friend struct DefaultSingletonTraits<StartupCustomizationDocument>; | 104 friend struct DefaultSingletonTraits<StartupCustomizationDocument>; |
| 88 | 105 |
| 89 // C-tor for singleton construction. | 106 // C-tor for singleton construction. |
| 90 StartupCustomizationDocument(); | 107 StartupCustomizationDocument(); |
| 91 | 108 |
| 92 // C-tor for test construction. | 109 // C-tor for test construction. |
| 93 StartupCustomizationDocument(system::StatisticsProvider* provider, | 110 StartupCustomizationDocument(system::StatisticsProvider* provider, |
| 94 const std::string& manifest); | 111 const std::string& manifest); |
| 95 | 112 |
| 96 virtual ~StartupCustomizationDocument(); | 113 virtual ~StartupCustomizationDocument(); |
| 97 | 114 |
| 98 void Init(system::StatisticsProvider* provider); | 115 void Init(system::StatisticsProvider* provider); |
| 99 | 116 |
| 100 // If |attr| exists in machine stat, assign it to |value|. | 117 // If |attr| exists in machine stat, assign it to |value|. |
| 101 void InitFromMachineStatistic(const char* attr, std::string* value); | 118 void InitFromMachineStatistic(const char* attr, std::string* value); |
| 102 | 119 |
| 103 std::string initial_locale_; | 120 std::string initial_locale_; |
| 121 std::vector<std::string> configured_locales_; | |
| 104 std::string initial_timezone_; | 122 std::string initial_timezone_; |
| 105 std::string keyboard_layout_; | 123 std::string keyboard_layout_; |
| 106 std::string registration_url_; | 124 std::string registration_url_; |
| 107 | 125 |
| 108 DISALLOW_COPY_AND_ASSIGN(StartupCustomizationDocument); | 126 DISALLOW_COPY_AND_ASSIGN(StartupCustomizationDocument); |
| 109 }; | 127 }; |
| 110 | 128 |
| 111 // OEM services customization document class. | 129 // OEM services customization document class. |
| 112 // ServicesCustomizationDocument is fetched from network or local file but on | 130 // ServicesCustomizationDocument is fetched from network or local file but on |
| 113 // FILE thread therefore it may not be ready just after creation. Fetching of | 131 // FILE thread therefore it may not be ready just after creation. Fetching of |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 131 // Apply customization and save in machine options that customization was | 149 // Apply customization and save in machine options that customization was |
| 132 // applied successfully. Return true if customization was applied. | 150 // applied successfully. Return true if customization was applied. |
| 133 bool ApplyCustomization(); | 151 bool ApplyCustomization(); |
| 134 | 152 |
| 135 std::string GetInitialStartPage(const std::string& locale) const; | 153 std::string GetInitialStartPage(const std::string& locale) const; |
| 136 std::string GetSupportPage(const std::string& locale) const; | 154 std::string GetSupportPage(const std::string& locale) const; |
| 137 | 155 |
| 138 private: | 156 private: |
| 139 FRIEND_TEST_ALL_PREFIXES(ServicesCustomizationDocumentTest, Basic); | 157 FRIEND_TEST_ALL_PREFIXES(ServicesCustomizationDocumentTest, Basic); |
| 140 FRIEND_TEST_ALL_PREFIXES(ServicesCustomizationDocumentTest, BadManifest); | 158 FRIEND_TEST_ALL_PREFIXES(ServicesCustomizationDocumentTest, BadManifest); |
| 159 FRIEND_TEST_ALL_PREFIXES(ServicesCustomizationDocumentTest, MultiLanguage); | |
| 141 friend struct DefaultSingletonTraits<ServicesCustomizationDocument>; | 160 friend struct DefaultSingletonTraits<ServicesCustomizationDocument>; |
| 142 | 161 |
| 143 // C-tor for singleton construction. | 162 // C-tor for singleton construction. |
| 144 ServicesCustomizationDocument(); | 163 ServicesCustomizationDocument(); |
| 145 | 164 |
| 146 // C-tor for test construction. | 165 // C-tor for test construction. |
| 147 explicit ServicesCustomizationDocument(const std::string& manifest); | 166 explicit ServicesCustomizationDocument(const std::string& manifest); |
| 148 | 167 |
| 149 virtual ~ServicesCustomizationDocument(); | 168 virtual ~ServicesCustomizationDocument(); |
| 150 | 169 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 171 | 190 |
| 172 // How many times we already tried to fetch customization manifest file. | 191 // How many times we already tried to fetch customization manifest file. |
| 173 int num_retries_; | 192 int num_retries_; |
| 174 | 193 |
| 175 DISALLOW_COPY_AND_ASSIGN(ServicesCustomizationDocument); | 194 DISALLOW_COPY_AND_ASSIGN(ServicesCustomizationDocument); |
| 176 }; | 195 }; |
| 177 | 196 |
| 178 } // namespace chromeos | 197 } // namespace chromeos |
| 179 | 198 |
| 180 #endif // CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_ | 199 #endif // CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_ |
| OLD | NEW |