| OLD | NEW |
| 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/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.h" | 15 #include "base/timer.h" |
| 15 #include "base/values.h" | 16 #include "base/values.h" |
| 16 #include "content/public/common/url_fetcher_delegate.h" | 17 #include "content/public/common/url_fetcher_delegate.h" |
| 17 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
| 18 | 19 |
| 19 class FilePath; | 20 class FilePath; |
| 20 class PrefService; | 21 class PrefService; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 142 |
| 142 // C-tor for test construction. | 143 // C-tor for test construction. |
| 143 explicit ServicesCustomizationDocument(const std::string& manifest); | 144 explicit ServicesCustomizationDocument(const std::string& manifest); |
| 144 | 145 |
| 145 virtual ~ServicesCustomizationDocument(); | 146 virtual ~ServicesCustomizationDocument(); |
| 146 | 147 |
| 147 // Save applied state in machine settings. | 148 // Save applied state in machine settings. |
| 148 static void SetApplied(bool val); | 149 static void SetApplied(bool val); |
| 149 | 150 |
| 150 // Overriden from content::URLFetcherDelegate: | 151 // Overriden from content::URLFetcherDelegate: |
| 151 virtual void OnURLFetchComplete(const content::URLFetcher* source); | 152 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE; |
| 152 | 153 |
| 153 // Initiate file fetching. | 154 // Initiate file fetching. |
| 154 void StartFileFetch(); | 155 void StartFileFetch(); |
| 155 | 156 |
| 156 // Executes on FILE thread and reads file to string. | 157 // Executes on FILE thread and reads file to string. |
| 157 void ReadFileInBackground(const FilePath& file); | 158 void ReadFileInBackground(const FilePath& file); |
| 158 | 159 |
| 159 // Services customization manifest URL. | 160 // Services customization manifest URL. |
| 160 GURL url_; | 161 GURL url_; |
| 161 | 162 |
| 162 // URLFetcher instance. | 163 // URLFetcher instance. |
| 163 scoped_ptr<content::URLFetcher> url_fetcher_; | 164 scoped_ptr<content::URLFetcher> url_fetcher_; |
| 164 | 165 |
| 165 // Timer to retry fetching file if network is not available. | 166 // Timer to retry fetching file if network is not available. |
| 166 base::OneShotTimer<ServicesCustomizationDocument> retry_timer_; | 167 base::OneShotTimer<ServicesCustomizationDocument> retry_timer_; |
| 167 | 168 |
| 168 // How many times we already tried to fetch customization manifest file. | 169 // How many times we already tried to fetch customization manifest file. |
| 169 int num_retries_; | 170 int num_retries_; |
| 170 | 171 |
| 171 DISALLOW_COPY_AND_ASSIGN(ServicesCustomizationDocument); | 172 DISALLOW_COPY_AND_ASSIGN(ServicesCustomizationDocument); |
| 172 }; | 173 }; |
| 173 | 174 |
| 174 } // namespace chromeos | 175 } // namespace chromeos |
| 175 | 176 |
| 176 #endif // CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_ | 177 #endif // CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_ |
| OLD | NEW |