OLD | NEW |
---|---|
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/shortcut_data_fetcher.h" | 5 #include "chrome/browser/android/shortcut_data_fetcher.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/task/cancelable_task_tracker.h" | 10 #include "base/task/cancelable_task_tracker.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 web_app_info.description.substr(0, chrome::kMaxMetaTagAttributeLength); | 66 web_app_info.description.substr(0, chrome::kMaxMetaTagAttributeLength); |
67 | 67 |
68 shortcut_info_.title = web_app_info.title.empty() ? web_contents()->GetTitle() | 68 shortcut_info_.title = web_app_info.title.empty() ? web_contents()->GetTitle() |
69 : web_app_info.title; | 69 : web_app_info.title; |
70 | 70 |
71 if (web_app_info.mobile_capable == WebApplicationInfo::MOBILE_CAPABLE || | 71 if (web_app_info.mobile_capable == WebApplicationInfo::MOBILE_CAPABLE || |
72 web_app_info.mobile_capable == WebApplicationInfo::MOBILE_CAPABLE_APPLE) { | 72 web_app_info.mobile_capable == WebApplicationInfo::MOBILE_CAPABLE_APPLE) { |
73 shortcut_info_.display = content::Manifest::DISPLAY_MODE_STANDALONE; | 73 shortcut_info_.display = content::Manifest::DISPLAY_MODE_STANDALONE; |
74 } | 74 } |
75 | 75 |
76 // Set the theme color to undefined | |
77 shortcut_info_.theme_color = -1; | |
mlamouri (slow - plz ping)
2015/07/17 13:28:29
Please use the content::Manifest constant.
| |
78 | |
76 // Record what type of shortcut was added by the user. | 79 // Record what type of shortcut was added by the user. |
77 switch (web_app_info.mobile_capable) { | 80 switch (web_app_info.mobile_capable) { |
78 case WebApplicationInfo::MOBILE_CAPABLE: | 81 case WebApplicationInfo::MOBILE_CAPABLE: |
79 content::RecordAction( | 82 content::RecordAction( |
80 base::UserMetricsAction("webapps.AddShortcut.AppShortcut")); | 83 base::UserMetricsAction("webapps.AddShortcut.AppShortcut")); |
81 break; | 84 break; |
82 case WebApplicationInfo::MOBILE_CAPABLE_APPLE: | 85 case WebApplicationInfo::MOBILE_CAPABLE_APPLE: |
83 content::RecordAction( | 86 content::RecordAction( |
84 base::UserMetricsAction("webapps.AddShortcut.AppShortcutApple")); | 87 base::UserMetricsAction("webapps.AddShortcut.AppShortcutApple")); |
85 break; | 88 break; |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
246 void ShortcutDataFetcher::NotifyObserver(const SkBitmap& bitmap) { | 249 void ShortcutDataFetcher::NotifyObserver(const SkBitmap& bitmap) { |
247 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 250 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
248 if (!web_contents() || !weak_observer_ || is_icon_saved_) | 251 if (!web_contents() || !weak_observer_ || is_icon_saved_) |
249 return; | 252 return; |
250 | 253 |
251 is_icon_saved_ = true; | 254 is_icon_saved_ = true; |
252 shortcut_icon_ = bitmap; | 255 shortcut_icon_ = bitmap; |
253 is_ready_ = true; | 256 is_ready_ = true; |
254 weak_observer_->OnDataAvailable(shortcut_info_, shortcut_icon_); | 257 weak_observer_->OnDataAvailable(shortcut_info_, shortcut_icon_); |
255 } | 258 } |
OLD | NEW |