OLD | NEW |
1 // Copyright (c) 2010 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_LOGIN_APPLY_SERVICES_CUSTOMIZATION_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_APPLY_SERVICES_CUSTOMIZATION_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_APPLY_SERVICES_CUSTOMIZATION_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_APPLY_SERVICES_CUSTOMIZATION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
(...skipping 24 matching lines...) Expand all Loading... |
36 | 36 |
37 // Initiate URL fetch, return true if the object will delete itself later. | 37 // Initiate URL fetch, return true if the object will delete itself later. |
38 bool Init(); | 38 bool Init(); |
39 | 39 |
40 // Initiate file fetching. | 40 // Initiate file fetching. |
41 void StartFileFetch(); | 41 void StartFileFetch(); |
42 | 42 |
43 // Overriden from URLFetcher::Delegate: | 43 // Overriden from URLFetcher::Delegate: |
44 virtual void OnURLFetchComplete(const URLFetcher* source, | 44 virtual void OnURLFetchComplete(const URLFetcher* source, |
45 const GURL& url, | 45 const GURL& url, |
46 const URLRequestStatus& status, | 46 const net::URLRequestStatus& status, |
47 int response_code, | 47 int response_code, |
48 const ResponseCookies& cookies, | 48 const ResponseCookies& cookies, |
49 const std::string& data); | 49 const std::string& data); |
50 | 50 |
51 // Applies given |manifest|. | 51 // Applies given |manifest|. |
52 void Apply(const std::string& manifest); | 52 void Apply(const std::string& manifest); |
53 | 53 |
54 // Remember in local state status of kServicesCustomizationAppliedPref. | 54 // Remember in local state status of kServicesCustomizationAppliedPref. |
55 static void SetApplied(bool val); | 55 static void SetApplied(bool val); |
56 | 56 |
57 // Services customization manifest URL. | 57 // Services customization manifest URL. |
58 GURL url_; | 58 GURL url_; |
59 | 59 |
60 // URLFetcher instance. | 60 // URLFetcher instance. |
61 scoped_ptr<URLFetcher> url_fetcher_; | 61 scoped_ptr<URLFetcher> url_fetcher_; |
62 | 62 |
63 // Timer to retry fetching file if network is not available. | 63 // Timer to retry fetching file if network is not available. |
64 base::OneShotTimer<ApplyServicesCustomization> retry_timer_; | 64 base::OneShotTimer<ApplyServicesCustomization> retry_timer_; |
65 | 65 |
66 // How many times we already tried to fetch customization manifest file. | 66 // How many times we already tried to fetch customization manifest file. |
67 int num_retries_; | 67 int num_retries_; |
68 | 68 |
69 DISALLOW_COPY_AND_ASSIGN(ApplyServicesCustomization); | 69 DISALLOW_COPY_AND_ASSIGN(ApplyServicesCustomization); |
70 }; | 70 }; |
71 | 71 |
72 } // namespace chromeos | 72 } // namespace chromeos |
73 | 73 |
74 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_APPLY_SERVICES_CUSTOMIZATION_H_ | 74 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_APPLY_SERVICES_CUSTOMIZATION_H_ |
OLD | NEW |