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

Side by Side Diff: chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc

Issue 2771233002: Remove the wrapper functions content::RecordAction et al (Closed)
Patch Set: Rebased Created 3 years, 9 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
« no previous file with comments | « chrome/browser/android/tab_android.cc ('k') | chrome/browser/app_controller_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "chrome/browser/android/webapps/add_to_homescreen_data_fetcher.h" 5 #include "chrome/browser/android/webapps/add_to_homescreen_data_fetcher.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/metrics/user_metrics.h"
11 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
12 #include "base/task_runner_util.h" 13 #include "base/task_runner_util.h"
13 #include "base/threading/sequenced_worker_pool.h" 14 #include "base/threading/sequenced_worker_pool.h"
14 #include "chrome/browser/android/offline_pages/offline_page_utils.h" 15 #include "chrome/browser/android/offline_pages/offline_page_utils.h"
15 #include "chrome/browser/android/shortcut_helper.h" 16 #include "chrome/browser/android/shortcut_helper.h"
16 #include "chrome/browser/android/webapk/webapk_web_manifest_checker.h" 17 #include "chrome/browser/android/webapk/webapk_web_manifest_checker.h"
17 #include "chrome/browser/favicon/favicon_service_factory.h" 18 #include "chrome/browser/favicon/favicon_service_factory.h"
18 #include "chrome/browser/installable/installable_manager.h" 19 #include "chrome/browser/installable/installable_manager.h"
19 #include "chrome/browser/manifest/manifest_icon_selector.h" 20 #include "chrome/browser/manifest/manifest_icon_selector.h"
20 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/common/chrome_constants.h" 22 #include "chrome/common/chrome_constants.h"
22 #include "chrome/common/render_messages.h" 23 #include "chrome/common/render_messages.h"
23 #include "chrome/common/web_application_info.h" 24 #include "chrome/common/web_application_info.h"
24 #include "components/dom_distiller/core/url_utils.h" 25 #include "components/dom_distiller/core/url_utils.h"
25 #include "components/favicon/core/favicon_service.h" 26 #include "components/favicon/core/favicon_service.h"
26 #include "components/favicon_base/favicon_types.h" 27 #include "components/favicon_base/favicon_types.h"
27 #include "content/public/browser/browser_thread.h" 28 #include "content/public/browser/browser_thread.h"
28 #include "content/public/browser/user_metrics.h"
29 #include "content/public/browser/web_contents.h" 29 #include "content/public/browser/web_contents.h"
30 #include "content/public/browser/web_contents_observer.h" 30 #include "content/public/browser/web_contents_observer.h"
31 #include "content/public/common/manifest.h" 31 #include "content/public/common/manifest.h"
32 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree nOrientationLockType.h" 32 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree nOrientationLockType.h"
33 #include "ui/gfx/codec/png_codec.h" 33 #include "ui/gfx/codec/png_codec.h"
34 #include "ui/gfx/favicon_size.h" 34 #include "ui/gfx/favicon_size.h"
35 #include "url/gurl.h" 35 #include "url/gurl.h"
36 36
37 namespace { 37 namespace {
38 38
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 if (web_app_info.mobile_capable == WebApplicationInfo::MOBILE_CAPABLE || 120 if (web_app_info.mobile_capable == WebApplicationInfo::MOBILE_CAPABLE ||
121 web_app_info.mobile_capable == WebApplicationInfo::MOBILE_CAPABLE_APPLE) { 121 web_app_info.mobile_capable == WebApplicationInfo::MOBILE_CAPABLE_APPLE) {
122 shortcut_info_.display = blink::WebDisplayModeStandalone; 122 shortcut_info_.display = blink::WebDisplayModeStandalone;
123 shortcut_info_.UpdateSource( 123 shortcut_info_.UpdateSource(
124 ShortcutInfo::SOURCE_ADD_TO_HOMESCREEN_STANDALONE); 124 ShortcutInfo::SOURCE_ADD_TO_HOMESCREEN_STANDALONE);
125 } 125 }
126 126
127 // Record what type of shortcut was added by the user. 127 // Record what type of shortcut was added by the user.
128 switch (web_app_info.mobile_capable) { 128 switch (web_app_info.mobile_capable) {
129 case WebApplicationInfo::MOBILE_CAPABLE: 129 case WebApplicationInfo::MOBILE_CAPABLE:
130 content::RecordAction( 130 base::RecordAction(
131 base::UserMetricsAction("webapps.AddShortcut.AppShortcut")); 131 base::UserMetricsAction("webapps.AddShortcut.AppShortcut"));
132 break; 132 break;
133 case WebApplicationInfo::MOBILE_CAPABLE_APPLE: 133 case WebApplicationInfo::MOBILE_CAPABLE_APPLE:
134 content::RecordAction( 134 base::RecordAction(
135 base::UserMetricsAction("webapps.AddShortcut.AppShortcutApple")); 135 base::UserMetricsAction("webapps.AddShortcut.AppShortcutApple"));
136 break; 136 break;
137 case WebApplicationInfo::MOBILE_CAPABLE_UNSPECIFIED: 137 case WebApplicationInfo::MOBILE_CAPABLE_UNSPECIFIED:
138 content::RecordAction( 138 base::RecordAction(
139 base::UserMetricsAction("webapps.AddShortcut.Bookmark")); 139 base::UserMetricsAction("webapps.AddShortcut.Bookmark"));
140 break; 140 break;
141 } 141 }
142 142
143 InstallableManager::CreateForWebContents(web_contents()); 143 InstallableManager::CreateForWebContents(web_contents());
144 InstallableManager* manager = 144 InstallableManager* manager =
145 InstallableManager::FromWebContents(web_contents()); 145 InstallableManager::FromWebContents(web_contents());
146 DCHECK(manager); 146 DCHECK(manager);
147 147
148 // Kick off a timeout for downloading data. If we haven't finished within the 148 // Kick off a timeout for downloading data. If we haven't finished within the
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 weak_observer_->OnDidDetermineWebApkCompatibility(webapk_compatible); 213 weak_observer_->OnDidDetermineWebApkCompatibility(webapk_compatible);
214 214
215 if (webapk_compatible) { 215 if (webapk_compatible) {
216 // WebAPKs are wholly defined by the Web Manifest. Ignore the <meta> tag 216 // WebAPKs are wholly defined by the Web Manifest. Ignore the <meta> tag
217 // data received in OnDidGetWebApplicationInfo(). 217 // data received in OnDidGetWebApplicationInfo().
218 shortcut_info_ = ShortcutInfo(GURL()); 218 shortcut_info_ = ShortcutInfo(GURL());
219 } 219 }
220 } 220 }
221 221
222 if (!data.manifest.IsEmpty()) { 222 if (!data.manifest.IsEmpty()) {
223 content::RecordAction( 223 base::RecordAction(base::UserMetricsAction("webapps.AddShortcut.Manifest"));
224 base::UserMetricsAction("webapps.AddShortcut.Manifest"));
225 shortcut_info_.UpdateFromManifest(data.manifest); 224 shortcut_info_.UpdateFromManifest(data.manifest);
226 shortcut_info_.manifest_url = data.manifest_url; 225 shortcut_info_.manifest_url = data.manifest_url;
227 226
228 if (webapk_compatible) { 227 if (webapk_compatible) {
229 shortcut_info_.UpdateSource(ShortcutInfo::SOURCE_ADD_TO_HOMESCREEN_PWA); 228 shortcut_info_.UpdateSource(ShortcutInfo::SOURCE_ADD_TO_HOMESCREEN_PWA);
230 229
231 if (data.badge_icon && !data.badge_icon->drawsNothing()) { 230 if (data.badge_icon && !data.badge_icon->drawsNothing()) {
232 shortcut_info_.best_badge_icon_url = data.badge_icon_url; 231 shortcut_info_.best_badge_icon_url = data.badge_icon_url;
233 badge_icon_ = *data.badge_icon; 232 badge_icon_ = *data.badge_icon;
234 } 233 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 void AddToHomescreenDataFetcher::NotifyObserver(const SkBitmap& primary_icon) { 338 void AddToHomescreenDataFetcher::NotifyObserver(const SkBitmap& primary_icon) {
340 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 339 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
341 if (!web_contents() || !weak_observer_ || is_icon_saved_) 340 if (!web_contents() || !weak_observer_ || is_icon_saved_)
342 return; 341 return;
343 342
344 is_icon_saved_ = true; 343 is_icon_saved_ = true;
345 primary_icon_ = primary_icon; 344 primary_icon_ = primary_icon;
346 is_ready_ = true; 345 is_ready_ = true;
347 weak_observer_->OnDataAvailable(shortcut_info_, primary_icon_, badge_icon_); 346 weak_observer_->OnDataAvailable(shortcut_info_, primary_icon_, badge_icon_);
348 } 347 }
OLDNEW
« no previous file with comments | « chrome/browser/android/tab_android.cc ('k') | chrome/browser/app_controller_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698