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

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

Issue 2064943002: Pass in extra parameters to WebApkBuilder#buildWebApkAsync() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' into webapk_manifest000 Created 4 years, 5 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 Observer* observer); 64 Observer* observer);
65 65
66 // Returns a callback which fetches the splash screen image to be stored for 66 // Returns a callback which fetches the splash screen image to be stored for
67 // the webapp with the specified |id|. 67 // the webapp with the specified |id|.
68 base::Closure FetchSplashScreenImageCallback(const std::string& id); 68 base::Closure FetchSplashScreenImageCallback(const std::string& id);
69 69
70 // IPC message received when the initialization is finished. 70 // IPC message received when the initialization is finished.
71 void OnDidGetWebApplicationInfo(const WebApplicationInfo& web_app_info); 71 void OnDidGetWebApplicationInfo(const WebApplicationInfo& web_app_info);
72 72
73 // Called when the Manifest has been parsed, or if no Manifest was found. 73 // Called when the Manifest has been parsed, or if no Manifest was found.
74 void OnDidGetManifest(const content::Manifest& manifest); 74 void OnDidGetManifest(const GURL& manifest_url,
75 const content::Manifest& manifest);
75 76
76 // Accessors, etc. 77 // Accessors, etc.
77 void set_weak_observer(Observer* observer) { weak_observer_ = observer; } 78 void set_weak_observer(Observer* observer) { weak_observer_ = observer; }
78 bool is_ready() { return is_ready_; } 79 bool is_ready() { return is_ready_; }
79 ShortcutInfo& shortcut_info() { return shortcut_info_; } 80 ShortcutInfo& shortcut_info() { return shortcut_info_; }
80 const SkBitmap& shortcut_icon() { return shortcut_icon_; } 81 const SkBitmap& shortcut_icon() { return shortcut_icon_; }
81 82
82 // WebContentsObserver 83 // WebContentsObserver
83 bool OnMessageReceived(const IPC::Message& message) override; 84 bool OnMessageReceived(const IPC::Message& message) override;
84 85
85 private: 86 private:
86 ~AddToHomescreenDataFetcher() override; 87 ~AddToHomescreenDataFetcher() override;
87 88
88 // Grabs the favicon for the current URL. 89 // Grabs the favicon for the current URL.
89 void FetchFavicon(); 90 void FetchFavicon();
90 void OnFaviconFetched( 91 void OnFaviconFetched(
91 const favicon_base::FaviconRawBitmapResult& bitmap_result); 92 const favicon_base::FaviconRawBitmapResult& bitmap_result);
92 93
93 // Creates the launcher icon from the given bitmap. 94 // Creates the launcher icon from the given bitmap.
94 void CreateLauncherIcon( 95 void CreateLauncherIcon(
95 const favicon_base::FaviconRawBitmapResult& bitmap_result); 96 const favicon_base::FaviconRawBitmapResult& bitmap_result);
96 97
97 // 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
98 // 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).
99 void OnManifestIconFetched(const SkBitmap& icon); 100 void OnManifestIconFetched(const GURL& icon_url, const SkBitmap& icon);
100 101
101 // Notifies the observer that the shortcut data is all available. 102 // Notifies the observer that the shortcut data is all available.
102 void NotifyObserver(const SkBitmap& icon, bool is_generated); 103 void NotifyObserver(const SkBitmap& icon);
103 104
104 // 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
105 // WebContents may be an offline page or a distilled article which is not 106 // WebContents may be an offline page or a distilled article which is not
106 // appropriate for a home screen shortcut. 107 // appropriate for a home screen shortcut.
107 GURL GetShortcutUrl(const GURL& original_url); 108 GURL GetShortcutUrl(const GURL& original_url);
108 109
109 Observer* weak_observer_; 110 Observer* weak_observer_;
110 111
111 bool is_waiting_for_web_application_info_; 112 bool is_waiting_for_web_application_info_;
112 bool is_icon_saved_; 113 bool is_icon_saved_;
113 bool is_ready_; 114 bool is_ready_;
114 base::Timer icon_timeout_timer_; 115 base::Timer icon_timeout_timer_;
115 ShortcutInfo shortcut_info_; 116 ShortcutInfo shortcut_info_;
116 GURL splash_screen_url_; 117 GURL splash_screen_url_;
117 118
118 // The icon must only be set on the UI thread for thread safety. 119 // The icon must only be set on the UI thread for thread safety.
119 SkBitmap shortcut_icon_; 120 SkBitmap shortcut_icon_;
120 base::CancelableTaskTracker favicon_task_tracker_; 121 base::CancelableTaskTracker favicon_task_tracker_;
121 122
122 const int ideal_icon_size_in_dp_; 123 const int ideal_icon_size_in_dp_;
123 const int minimum_icon_size_in_dp_; 124 const int minimum_icon_size_in_dp_;
124 const int ideal_splash_image_size_in_dp_; 125 const int ideal_splash_image_size_in_dp_;
125 const int minimum_splash_image_size_in_dp_; 126 const int minimum_splash_image_size_in_dp_;
126 127
127 friend class base::RefCounted<AddToHomescreenDataFetcher>; 128 friend class base::RefCounted<AddToHomescreenDataFetcher>;
128 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDataFetcher); 129 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDataFetcher);
129 }; 130 };
130 131
131 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_ 132 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/shortcut_info.cc ('k') | chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698