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

Side by Side Diff: chrome/browser/chromeos/customization_document.h

Issue 7259019: Move base/values.h into the base namespace. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 unified diff | Download patch | Annotate | Revision Log
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 #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 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 11
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/singleton.h" 14 #include "base/memory/singleton.h"
15 #include "base/timer.h" 15 #include "base/timer.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "content/common/url_fetcher.h" 17 #include "content/common/url_fetcher.h"
18 #include "googleurl/src/gurl.h" 18 #include "googleurl/src/gurl.h"
19 19
20 class DictionaryValue;
21 class FilePath; 20 class FilePath;
22 class ListValue;
23 class PrefService; 21 class PrefService;
24 22
25 namespace base { 23 namespace base {
26 class Time; 24 class DictionaryValue;
25 class ListValue;
26 class Time;
27 } 27 }
28 28
29 namespace chromeos { 29 namespace chromeos {
30 30
31 namespace system { 31 namespace system {
32 class StatisticsProvider; 32 class StatisticsProvider;
33 } // system 33 } // system
34 34
35 // Base class for OEM customization document classes. 35 // Base class for OEM customization document classes.
36 class CustomizationDocument { 36 class CustomizationDocument {
37 public: 37 public:
38 virtual ~CustomizationDocument(); 38 virtual ~CustomizationDocument();
39 39
40 // Return true if the document was successfully fetched and parsed. 40 // Return true if the document was successfully fetched and parsed.
41 bool IsReady() const { return root_.get(); } 41 bool IsReady() const { return root_.get(); }
42 42
43 protected: 43 protected:
44 CustomizationDocument(); 44 CustomizationDocument();
45 45
46 virtual bool LoadManifestFromFile(const FilePath& manifest_path); 46 virtual bool LoadManifestFromFile(const FilePath& manifest_path);
47 virtual bool LoadManifestFromString(const std::string& manifest); 47 virtual bool LoadManifestFromString(const std::string& manifest);
48 48
49 std::string GetLocaleSpecificString(const std::string& locale, 49 std::string GetLocaleSpecificString(const std::string& locale,
50 const std::string& dictionary_name, 50 const std::string& dictionary_name,
51 const std::string& entry_name) const; 51 const std::string& entry_name) const;
52 52
53 scoped_ptr<DictionaryValue> root_; 53 scoped_ptr<base::DictionaryValue> root_;
54 54
55 private: 55 private:
56 DISALLOW_COPY_AND_ASSIGN(CustomizationDocument); 56 DISALLOW_COPY_AND_ASSIGN(CustomizationDocument);
57 }; 57 };
58 58
59 // OEM startup customization document class. 59 // OEM startup customization document class.
60 // Now StartupCustomizationDocument is loaded in c-tor so just after create it 60 // Now StartupCustomizationDocument is loaded in c-tor so just after create it
61 // may be ready or not (if manifest is missing or corrupted) and this state 61 // may be ready or not (if manifest is missing or corrupted) and this state
62 // won't be changed later (i.e. IsReady() always return the same value). 62 // won't be changed later (i.e. IsReady() always return the same value).
63 class StartupCustomizationDocument : public CustomizationDocument { 63 class StartupCustomizationDocument : public CustomizationDocument {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // ServicesCustomizationDocument is fetched from network or local file but on 104 // ServicesCustomizationDocument is fetched from network or local file but on
105 // FILE thread therefore it may not be ready just after creation. Fetching of 105 // FILE thread therefore it may not be ready just after creation. Fetching of
106 // the manifest should be initiated outside this class by calling 106 // the manifest should be initiated outside this class by calling
107 // StartFetching() method. User of the file should check IsReady before use it. 107 // StartFetching() method. User of the file should check IsReady before use it.
108 class ServicesCustomizationDocument : public CustomizationDocument, 108 class ServicesCustomizationDocument : public CustomizationDocument,
109 private URLFetcher::Delegate { 109 private URLFetcher::Delegate {
110 public: 110 public:
111 // OEM specific carrier deal. 111 // OEM specific carrier deal.
112 class CarrierDeal { 112 class CarrierDeal {
113 public: 113 public:
114 explicit CarrierDeal(DictionaryValue* deal_dict); 114 explicit CarrierDeal(base::DictionaryValue* deal_dict);
115 ~CarrierDeal(); 115 ~CarrierDeal();
116 116
117 // Returns string with the specified |locale| and |id|. 117 // Returns string with the specified |locale| and |id|.
118 // If there's no version for |locale|, default one is returned. 118 // If there's no version for |locale|, default one is returned.
119 // If there's no string with specified |id|, empty string is returned. 119 // If there's no string with specified |id|, empty string is returned.
120 std::string GetLocalizedString(const std::string& locale, 120 std::string GetLocalizedString(const std::string& locale,
121 const std::string& id) const; 121 const std::string& id) const;
122 122
123 const std::string& deal_locale() const { return deal_locale_; } 123 const std::string& deal_locale() const { return deal_locale_; }
124 const std::string& info_url() const { return info_url_; } 124 const std::string& info_url() const { return info_url_; }
125 const std::string& top_up_url() const { return top_up_url_; } 125 const std::string& top_up_url() const { return top_up_url_; }
126 int notification_count() const { return notification_count_; } 126 int notification_count() const { return notification_count_; }
127 base::Time expire_date() const { return expire_date_; } 127 base::Time expire_date() const { return expire_date_; }
128 128
129 private: 129 private:
130 std::string deal_locale_; 130 std::string deal_locale_;
131 std::string info_url_; 131 std::string info_url_;
132 std::string top_up_url_; 132 std::string top_up_url_;
133 int notification_count_; 133 int notification_count_;
134 base::Time expire_date_; 134 base::Time expire_date_;
135 DictionaryValue* localized_strings_; 135 base::DictionaryValue* localized_strings_;
136 136
137 DISALLOW_COPY_AND_ASSIGN(CarrierDeal); 137 DISALLOW_COPY_AND_ASSIGN(CarrierDeal);
138 }; 138 };
139 139
140 // Carrier ID (ex. "Verizon (us)") mapping to carrier deals. 140 // Carrier ID (ex. "Verizon (us)") mapping to carrier deals.
141 typedef std::map<std::string, CarrierDeal*> CarrierDeals; 141 typedef std::map<std::string, CarrierDeal*> CarrierDeals;
142 142
143 static ServicesCustomizationDocument* GetInstance(); 143 static ServicesCustomizationDocument* GetInstance();
144 144
145 // Registers preferences. 145 // Registers preferences.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 219
220 // Initial locale value. 220 // Initial locale value.
221 std::string initial_locale_; 221 std::string initial_locale_;
222 222
223 DISALLOW_COPY_AND_ASSIGN(ServicesCustomizationDocument); 223 DISALLOW_COPY_AND_ASSIGN(ServicesCustomizationDocument);
224 }; 224 };
225 225
226 } // namespace chromeos 226 } // namespace chromeos
227 227
228 #endif // CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_ 228 #endif // CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros_settings_provider.cc ('k') | chrome/browser/chromeos/locale_change_guard.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698