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

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

Issue 8373021: Convert URLFetcher::Delegates to use an interface in content/public/common. Also remove the old U... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync and remove unncessary forward declares Created 9 years, 2 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 <string> 9 #include <string>
10 10
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/singleton.h" 13 #include "base/memory/singleton.h"
14 #include "base/timer.h" 14 #include "base/timer.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "content/common/net/url_fetcher.h" 16 #include "content/public/common/url_fetcher_delegate.h"
17 #include "googleurl/src/gurl.h" 17 #include "googleurl/src/gurl.h"
18 18
19 class FilePath; 19 class FilePath;
20 class PrefService; 20 class PrefService;
21 21
22 namespace base { 22 namespace base {
23 class DictionaryValue; 23 class DictionaryValue;
24 class ListValue; 24 class ListValue;
25 } 25 }
26 26
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 DISALLOW_COPY_AND_ASSIGN(StartupCustomizationDocument); 105 DISALLOW_COPY_AND_ASSIGN(StartupCustomizationDocument);
106 }; 106 };
107 107
108 // OEM services customization document class. 108 // OEM services customization document class.
109 // ServicesCustomizationDocument is fetched from network or local file but on 109 // ServicesCustomizationDocument is fetched from network or local file but on
110 // FILE thread therefore it may not be ready just after creation. Fetching of 110 // FILE thread therefore it may not be ready just after creation. Fetching of
111 // the manifest should be initiated outside this class by calling 111 // the manifest should be initiated outside this class by calling
112 // StartFetching() method. User of the file should check IsReady before use it. 112 // StartFetching() method. User of the file should check IsReady before use it.
113 class ServicesCustomizationDocument : public CustomizationDocument, 113 class ServicesCustomizationDocument : public CustomizationDocument,
114 private URLFetcher::Delegate { 114 private content::URLFetcherDelegate {
115 public: 115 public:
116 static ServicesCustomizationDocument* GetInstance(); 116 static ServicesCustomizationDocument* GetInstance();
117 117
118 // Registers preferences. 118 // Registers preferences.
119 static void RegisterPrefs(PrefService* local_state); 119 static void RegisterPrefs(PrefService* local_state);
120 120
121 // Return true if the customization was applied. Customization is applied only 121 // Return true if the customization was applied. Customization is applied only
122 // once per machine. 122 // once per machine.
123 static bool WasApplied(); 123 static bool WasApplied();
124 124
(...skipping 16 matching lines...) Expand all
141 ServicesCustomizationDocument(); 141 ServicesCustomizationDocument();
142 142
143 // C-tor for test construction. 143 // C-tor for test construction.
144 explicit ServicesCustomizationDocument(const std::string& manifest); 144 explicit ServicesCustomizationDocument(const std::string& manifest);
145 145
146 virtual ~ServicesCustomizationDocument(); 146 virtual ~ServicesCustomizationDocument();
147 147
148 // Save applied state in machine settings. 148 // Save applied state in machine settings.
149 static void SetApplied(bool val); 149 static void SetApplied(bool val);
150 150
151 // Overriden from URLFetcher::Delegate: 151 // Overriden from content::URLFetcherDelegate:
152 virtual void OnURLFetchComplete(const URLFetcher* source, 152 virtual void OnURLFetchComplete(const URLFetcher* source);
153 const GURL& url,
154 const net::URLRequestStatus& status,
155 int response_code,
156 const net::ResponseCookies& cookies,
157 const std::string& data);
158 153
159 // Initiate file fetching. 154 // Initiate file fetching.
160 void StartFileFetch(); 155 void StartFileFetch();
161 156
162 // Executes on FILE thread and reads file to string. 157 // Executes on FILE thread and reads file to string.
163 void ReadFileInBackground(const FilePath& file); 158 void ReadFileInBackground(const FilePath& file);
164 159
165 // Services customization manifest URL. 160 // Services customization manifest URL.
166 GURL url_; 161 GURL url_;
167 162
168 // URLFetcher instance. 163 // URLFetcher instance.
169 scoped_ptr<URLFetcher> url_fetcher_; 164 scoped_ptr<URLFetcher> url_fetcher_;
170 165
171 // Timer to retry fetching file if network is not available. 166 // Timer to retry fetching file if network is not available.
172 base::OneShotTimer<ServicesCustomizationDocument> retry_timer_; 167 base::OneShotTimer<ServicesCustomizationDocument> retry_timer_;
173 168
174 // How many times we already tried to fetch customization manifest file. 169 // How many times we already tried to fetch customization manifest file.
175 int num_retries_; 170 int num_retries_;
176 171
177 DISALLOW_COPY_AND_ASSIGN(ServicesCustomizationDocument); 172 DISALLOW_COPY_AND_ASSIGN(ServicesCustomizationDocument);
178 }; 173 };
179 174
180 } // namespace chromeos 175 } // namespace chromeos
181 176
182 #endif // CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_ 177 #endif // CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698