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

Side by Side Diff: chrome/browser/installable/installable_manager.h

Issue 2178833002: Add new app banner metrics using InstallableStatusCode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@banner-integrate-checker-no-refptr
Patch Set: Fix histogram name Created 4 years, 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_INSTALLABLE_INSTALLABLE_MANAGER_H_ 5 #ifndef CHROME_BROWSER_INSTALLABLE_INSTALLABLE_MANAGER_H_
6 #define CHROME_BROWSER_INSTALLABLE_INSTALLABLE_MANAGER_H_ 6 #define CHROME_BROWSER_INSTALLABLE_INSTALLABLE_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 29 matching lines...) Expand all
40 // parameters, and that the icon can be fetched and isn't an empty bitmap. 40 // parameters, and that the icon can be fetched and isn't an empty bitmap.
41 bool fetch_valid_icon = false; 41 bool fetch_valid_icon = false;
42 }; 42 };
43 43
44 // This struct is passed to an InstallableCallback when the InstallableManager 44 // This struct is passed to an InstallableCallback when the InstallableManager
45 // has finished working. Each reference is owned by InstallableManager, and 45 // has finished working. Each reference is owned by InstallableManager, and
46 // callers should copy any objects which they wish to use later. Non-requested 46 // callers should copy any objects which they wish to use later. Non-requested
47 // fields will be set to null, empty, or false. 47 // fields will be set to null, empty, or false.
48 struct InstallableData { 48 struct InstallableData {
49 // NO_ERROR_DETECTED if there were no issues. 49 // NO_ERROR_DETECTED if there were no issues.
50 const InstallableErrorCode error_code; 50 const InstallableStatusCode error_code;
51 51
52 // Empty if the site has no <link rel="manifest"> tag. 52 // Empty if the site has no <link rel="manifest"> tag.
53 const GURL& manifest_url; 53 const GURL& manifest_url;
54 54
55 // Empty if the site has an unparseable manifest. 55 // Empty if the site has an unparseable manifest.
56 const content::Manifest& manifest; 56 const content::Manifest& manifest;
57 57
58 // Empty if no icon was requested. 58 // Empty if no icon was requested.
59 const GURL& icon_url; 59 const GURL& icon_url;
60 60
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 114
115 // Returns true if the icon sizes in |params| matches any fetched icon. false 115 // Returns true if the icon sizes in |params| matches any fetched icon. false
116 // if no icon has been requested yet or there is no match. 116 // if no icon has been requested yet or there is no match.
117 bool IsIconFetched(const InstallableParams& params) const; 117 bool IsIconFetched(const InstallableParams& params) const;
118 118
119 // Sets the icon parameters in |params| as being fetched. 119 // Sets the icon parameters in |params| as being fetched.
120 void SetIconFetched(const InstallableParams& params); 120 void SetIconFetched(const InstallableParams& params);
121 121
122 // Returns the error code associated with the resources requested in |params|, 122 // Returns the error code associated with the resources requested in |params|,
123 // or NO_ERROR_DETECTED if there is no error. 123 // or NO_ERROR_DETECTED if there is no error.
124 InstallableErrorCode GetErrorCode(const InstallableParams& params); 124 InstallableStatusCode GetErrorCode(const InstallableParams& params);
125 125
126 // Gets/sets parts of particular properties. Exposed for testing. 126 // Gets/sets parts of particular properties. Exposed for testing.
127 InstallableErrorCode manifest_error() const; 127 InstallableStatusCode manifest_error() const;
128 InstallableErrorCode installable_error() const; 128 InstallableStatusCode installable_error() const;
129 void set_installable_error(InstallableErrorCode error_code); 129 void set_installable_error(InstallableStatusCode error_code);
130 InstallableErrorCode icon_error(const IconParams& icon_params); 130 InstallableStatusCode icon_error(const IconParams& icon_params);
131 GURL& icon_url(const IconParams& icon_params); 131 GURL& icon_url(const IconParams& icon_params);
132 const SkBitmap* icon(const IconParams& icon); 132 const SkBitmap* icon(const IconParams& icon);
133 133
134 // Returns the WebContents to which this object is attached, or nullptr if the 134 // Returns the WebContents to which this object is attached, or nullptr if the
135 // WebContents doesn't exist or is currently being destroyed. 135 // WebContents doesn't exist or is currently being destroyed.
136 content::WebContents* GetWebContents(); 136 content::WebContents* GetWebContents();
137 137
138 // Returns true if |params| requires no more work to be done. 138 // Returns true if |params| requires no more work to be done.
139 bool IsComplete(const InstallableParams& params) const; 139 bool IsComplete(const InstallableParams& params) const;
140 140
141 // Resets members to empty and removes all queued tasks. 141 // Resets members to empty and removes all queued tasks.
142 // Called when navigating to a new page or if the WebContents is destroyed 142 // Called when navigating to a new page or if the WebContents is destroyed
143 // whilst waiting for a callback. 143 // whilst waiting for a callback.
144 void Reset(); 144 void Reset();
145 145
146 // Sets the fetched bit on the installable and icon subtasks. 146 // Sets the fetched bit on the installable and icon subtasks.
147 // Called if no manifest (or an empty manifest) was fetched from the site. 147 // Called if no manifest (or an empty manifest) was fetched from the site.
148 void SetManifestDependentTasksComplete(); 148 void SetManifestDependentTasksComplete();
149 149
150 // Methods coordinating and dispatching work for the current task. 150 // Methods coordinating and dispatching work for the current task.
151 void RunCallback(const Task& task, InstallableErrorCode error); 151 void RunCallback(const Task& task, InstallableStatusCode error);
152 void StartNextTask(); 152 void StartNextTask();
153 void WorkOnTask(); 153 void WorkOnTask();
154 154
155 // Data retrieval methods. 155 // Data retrieval methods.
156 void FetchManifest(); 156 void FetchManifest();
157 void OnDidGetManifest(const GURL& manifest_url, 157 void OnDidGetManifest(const GURL& manifest_url,
158 const content::Manifest& manifest); 158 const content::Manifest& manifest);
159 159
160 void CheckInstallable(); 160 void CheckInstallable();
161 bool IsManifestValidForWebApp(const content::Manifest& manifest); 161 bool IsManifestValidForWebApp(const content::Manifest& manifest);
(...skipping 20 matching lines...) Expand all
182 std::map<IconParams, IconProperty> icons_; 182 std::map<IconParams, IconProperty> icons_;
183 183
184 bool is_active_; 184 bool is_active_;
185 185
186 base::WeakPtrFactory<InstallableManager> weak_factory_; 186 base::WeakPtrFactory<InstallableManager> weak_factory_;
187 187
188 DISALLOW_COPY_AND_ASSIGN(InstallableManager); 188 DISALLOW_COPY_AND_ASSIGN(InstallableManager);
189 }; 189 };
190 190
191 #endif // CHROME_BROWSER_INSTALLABLE_INSTALLABLE_MANAGER_H_ 191 #endif // CHROME_BROWSER_INSTALLABLE_INSTALLABLE_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/installable/installable_logging.cc ('k') | chrome/browser/installable/installable_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698