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

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

Issue 1310223002: webapps: initial addition of splash screen icon downloading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webapps-database-exp
Patch Set: Fix compile Created 5 years, 3 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/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/task/cancelable_task_tracker.h" 9 #include "base/task/cancelable_task_tracker.h"
10 #include "base/timer/timer.h" 10 #include "base/timer/timer.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 // Called when all the data needed to create a shortcut is available. 47 // Called when all the data needed to create a shortcut is available.
48 virtual void OnDataAvailable(const ShortcutInfo& info, 48 virtual void OnDataAvailable(const ShortcutInfo& info,
49 const SkBitmap& icon) = 0; 49 const SkBitmap& icon) = 0;
50 }; 50 };
51 51
52 // Initialize the fetcher by requesting the information about the page to the 52 // Initialize the fetcher by requesting the information about the page to the
53 // renderer process. The initialization is asynchronous and 53 // renderer process. The initialization is asynchronous and
54 // OnDidGetWebApplicationInfo is expected to be called when finished. 54 // OnDidGetWebApplicationInfo is expected to be called when finished.
55 AddToHomescreenDataFetcher(content::WebContents* web_contents, 55 AddToHomescreenDataFetcher(content::WebContents* web_contents,
56 int ideal_splash_image_size_in_dp,
57 int ideal_icon_size_in_dp,
56 Observer* observer); 58 Observer* observer);
57 59
60 // Called to fetch the splash screen image to be stored for the webapp with
61 // the specified |id|.
62 void FetchSplashScreenImage(const std::string& id);
63
58 // IPC message received when the initialization is finished. 64 // IPC message received when the initialization is finished.
59 void OnDidGetWebApplicationInfo(const WebApplicationInfo& web_app_info); 65 void OnDidGetWebApplicationInfo(const WebApplicationInfo& web_app_info);
60 66
61 // Called when the Manifest has been parsed, or if no Manifest was found. 67 // Called when the Manifest has been parsed, or if no Manifest was found.
62 void OnDidGetManifest(const content::Manifest& manifest); 68 void OnDidGetManifest(const content::Manifest& manifest);
63 69
64 // Accessors, etc. 70 // Accessors, etc.
65 void set_weak_observer(Observer* observer) { weak_observer_ = observer; } 71 void set_weak_observer(Observer* observer) { weak_observer_ = observer; }
66 bool is_ready() { return is_ready_; } 72 bool is_ready() { return is_ready_; }
67 ShortcutInfo& shortcut_info() { return shortcut_info_; } 73 ShortcutInfo& shortcut_info() { return shortcut_info_; }
(...skipping 21 matching lines...) Expand all
89 // Notifies the observer that the shortcut data is all available. 95 // Notifies the observer that the shortcut data is all available.
90 void NotifyObserver(const SkBitmap& icon); 96 void NotifyObserver(const SkBitmap& icon);
91 97
92 Observer* weak_observer_; 98 Observer* weak_observer_;
93 99
94 bool is_waiting_for_web_application_info_; 100 bool is_waiting_for_web_application_info_;
95 bool is_icon_saved_; 101 bool is_icon_saved_;
96 bool is_ready_; 102 bool is_ready_;
97 base::Timer icon_timeout_timer_; 103 base::Timer icon_timeout_timer_;
98 ShortcutInfo shortcut_info_; 104 ShortcutInfo shortcut_info_;
105 GURL splash_screen_url_;
99 106
100 // The icon must only be set on the UI thread for thread safety. 107 // The icon must only be set on the UI thread for thread safety.
101 SkBitmap shortcut_icon_; 108 SkBitmap shortcut_icon_;
102 base::CancelableTaskTracker favicon_task_tracker_; 109 base::CancelableTaskTracker favicon_task_tracker_;
103 110
104 const int preferred_icon_size_in_px_; 111 const int ideal_splash_image_size_in_dp_;
105 static const int kPreferredIconSizeInDp; 112 const int ideal_icon_size_in_dp_;
106 113
107 friend class base::RefCounted<AddToHomescreenDataFetcher>; 114 friend class base::RefCounted<AddToHomescreenDataFetcher>;
108 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDataFetcher); 115 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDataFetcher);
109 }; 116 };
110 117
111 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_ 118 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/shortcut_helper.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