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

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

Issue 2218413002: Calls ShortcutHelper::FinalizeLauncherIcon() on worker thread instead of on IO thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 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 #ifndef CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_ 5 #ifndef CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_
6 #define CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_ 6 #define CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_
7 7
8 #include "base/callback_forward.h" 8 #include "base/callback_forward.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/task/cancelable_task_tracker.h" 10 #include "base/task/cancelable_task_tracker.h"
(...skipping 26 matching lines...) Expand all
37 public content::WebContentsObserver { 37 public content::WebContentsObserver {
38 public: 38 public:
39 class Observer { 39 class Observer {
40 public: 40 public:
41 // Called when the title of the page is available. 41 // Called when the title of the page is available.
42 virtual void OnUserTitleAvailable(const base::string16& title) = 0; 42 virtual void OnUserTitleAvailable(const base::string16& title) = 0;
43 43
44 // Converts the icon into one that can be used on the Android Home screen. 44 // Converts the icon into one that can be used on the Android Home screen.
45 // |is_generated| is an out-param that indicates whether the icon was 45 // |is_generated| is an out-param that indicates whether the icon was
46 // generated by Chrome. 46 // generated by Chrome.
47 virtual SkBitmap FinalizeLauncherIcon(const SkBitmap& icon, 47 virtual SkBitmap FinalizeLauncherIconInBackground(const SkBitmap& icon,
48 const GURL& url, 48 const GURL& url,
49 bool* is_generated) = 0; 49 bool* is_generated) = 0;
50 50
51 // Called when all the data needed to create a shortcut is available. 51 // Called when all the data needed to create a shortcut is available.
52 virtual void OnDataAvailable(const ShortcutInfo& info, 52 virtual void OnDataAvailable(const ShortcutInfo& info,
53 const SkBitmap& icon) = 0; 53 const SkBitmap& icon) = 0;
54 }; 54 };
55 55
56 // Initialize the fetcher by requesting the information about the page to the 56 // Initialize the fetcher by requesting the information about the page to the
57 // renderer process. The initialization is asynchronous and 57 // renderer process. The initialization is asynchronous and
58 // OnDidGetWebApplicationInfo is expected to be called when finished. 58 // OnDidGetWebApplicationInfo is expected to be called when finished.
59 AddToHomescreenDataFetcher(content::WebContents* web_contents, 59 AddToHomescreenDataFetcher(content::WebContents* web_contents,
(...skipping 25 matching lines...) Expand all
85 85
86 private: 86 private:
87 ~AddToHomescreenDataFetcher() override; 87 ~AddToHomescreenDataFetcher() override;
88 88
89 // Grabs the favicon for the current URL. 89 // Grabs the favicon for the current URL.
90 void FetchFavicon(); 90 void FetchFavicon();
91 void OnFaviconFetched( 91 void OnFaviconFetched(
92 const favicon_base::FaviconRawBitmapResult& bitmap_result); 92 const favicon_base::FaviconRawBitmapResult& bitmap_result);
93 93
94 // Creates the launcher icon from the given bitmap. 94 // Creates the launcher icon from the given bitmap.
95 void CreateLauncherIcon( 95 void CreateLauncherIconInBackground(
96 const favicon_base::FaviconRawBitmapResult& bitmap_result); 96 const favicon_base::FaviconRawBitmapResult& bitmap_result);
97 97
98 // Callback run after an attempt to download manifest icon has been made. May 98 // Callback run after an attempt to download manifest icon has been made. May
99 // kick off the download of a favicon if it failed (i.e. the bitmap is empty). 99 // kick off the download of a favicon if it failed (i.e. the bitmap is empty).
100 void OnManifestIconFetched(const GURL& icon_url, const SkBitmap& icon); 100 void OnManifestIconFetched(const GURL& icon_url, const SkBitmap& icon);
101 101
102 // Notifies the observer that the shortcut data is all available. 102 // Notifies the observer that the shortcut data is all available.
103 void NotifyObserver(const SkBitmap& icon); 103 void NotifyObserver(const SkBitmap& icon);
104 104
105 // Looks up the original, online URL of the site requested. The URL from the 105 // Looks up the original, online URL of the site requested. The URL from the
(...skipping 17 matching lines...) Expand all
123 const int ideal_icon_size_in_dp_; 123 const int ideal_icon_size_in_dp_;
124 const int minimum_icon_size_in_dp_; 124 const int minimum_icon_size_in_dp_;
125 const int ideal_splash_image_size_in_dp_; 125 const int ideal_splash_image_size_in_dp_;
126 const int minimum_splash_image_size_in_dp_; 126 const int minimum_splash_image_size_in_dp_;
127 127
128 friend class base::RefCounted<AddToHomescreenDataFetcher>; 128 friend class base::RefCounted<AddToHomescreenDataFetcher>;
129 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDataFetcher); 129 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDataFetcher);
130 }; 130 };
131 131
132 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_ 132 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698