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

Side by Side Diff: chrome/browser/chromeos/login/apply_services_customization.h

Issue 6902107: Merge 82987, 83304 - make sure that OEM tab is shown even if first login is Guest (Closed) Base URL: svn://svn.chromium.org/chrome/branches/742/src/
Patch Set: Created 9 years, 8 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_APPLY_SERVICES_CUSTOMIZATION_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_APPLY_SERVICES_CUSTOMIZATION_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/timer.h"
13 #include "chrome/common/net/url_fetcher.h"
14 #include "googleurl/src/gurl.h"
15
16 class FilePath;
17 class PrefService;
18
19 namespace chromeos {
20
21 // This class fetches services customization document and apply it
22 // as soon as the document is downloaded.
23 class ApplyServicesCustomization : public URLFetcher::Delegate {
24 public:
25 // This method checks if service customization has been applied and if not
26 // starts the process.
27 static void StartIfNeeded();
28
29 // Registers preferences.
30 static void RegisterPrefs(PrefService* local_state);
31
32 // Returns true if service customization has been applied.
33 static bool IsApplied();
34
35 private:
36 explicit ApplyServicesCustomization(const std::string& url_str);
37
38 // Initiate URL fetch, return true if the object will delete itself later.
39 bool Init();
40
41 // Initiate file fetching.
42 void StartFileFetch();
43
44 // Overriden from URLFetcher::Delegate:
45 virtual void OnURLFetchComplete(const URLFetcher* source,
46 const GURL& url,
47 const net::URLRequestStatus& status,
48 int response_code,
49 const ResponseCookies& cookies,
50 const std::string& data);
51
52 // Applies given |manifest|.
53 void Apply(const std::string& manifest);
54
55 // Applies given |manifest| and delete this object.
56 void ApplyAndDelete(const std::string& manifest);
57
58 // Executes on FILE thread and reads file to string.
59 void ReadFileInBackground(const FilePath& file);
60
61 // Remember in local state status of kServicesCustomizationAppliedPref.
62 static void SetApplied(bool val);
63
64 // Services customization manifest URL.
65 GURL url_;
66
67 // URLFetcher instance.
68 scoped_ptr<URLFetcher> url_fetcher_;
69
70 // Timer to retry fetching file if network is not available.
71 base::OneShotTimer<ApplyServicesCustomization> retry_timer_;
72
73 // How many times we already tried to fetch customization manifest file.
74 int num_retries_;
75
76 DISALLOW_COPY_AND_ASSIGN(ApplyServicesCustomization);
77 };
78
79 } // namespace chromeos
80
81 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_APPLY_SERVICES_CUSTOMIZATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698