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

Side by Side Diff: chrome/browser/android/shortcut_data_fetcher.h

Issue 1124433005: Introduce timeout for downloading a favicon for adding to Home screen (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dialog
Patch Set: Rebasing Created 5 years, 7 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_SHORTCUT_DATA_FETCHER_H_ 5 #ifndef CHROME_BROWSER_ANDROID_SHORTCUT_DATA_FETCHER_H_
6 #define CHROME_BROWSER_ANDROID_SHORTCUT_DATA_FETCHER_H_ 6 #define CHROME_BROWSER_ANDROID_SHORTCUT_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 "chrome/browser/android/shortcut_info.h" 11 #include "chrome/browser/android/shortcut_info.h"
11 #include "chrome/common/web_application_info.h" 12 #include "chrome/common/web_application_info.h"
12 #include "components/favicon_base/favicon_types.h" 13 #include "components/favicon_base/favicon_types.h"
13 #include "content/public/browser/web_contents_observer.h" 14 #include "content/public/browser/web_contents_observer.h"
14 #include "content/public/common/manifest.h" 15 #include "content/public/common/manifest.h"
15 16
16 namespace content { 17 namespace content {
17 class WebContents; 18 class WebContents;
18 } // namespace content 19 } // namespace content
19 20
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 83
83 // Callback run after an attempt to download manifest icon has been made. May 84 // Callback run after an attempt to download manifest icon has been made. May
84 // kick off the download of a favicon if it failed. 85 // kick off the download of a favicon if it failed.
85 void OnManifestIconFetched(int id, 86 void OnManifestIconFetched(int id,
86 int http_status_code, 87 int http_status_code,
87 const GURL& url, 88 const GURL& url,
88 const std::vector<SkBitmap>& bitmaps, 89 const std::vector<SkBitmap>& bitmaps,
89 const std::vector<gfx::Size>& sizes); 90 const std::vector<gfx::Size>& sizes);
90 91
91 // Notifies the observer that the shortcut data is all available. 92 // Notifies the observer that the shortcut data is all available.
92 void NotifyObserver(); 93 void NotifyObserver(const SkBitmap& icon);
93 94
94 Observer* weak_observer_; 95 Observer* weak_observer_;
95 96
96 bool is_waiting_for_web_application_info_; 97 bool is_waiting_for_web_application_info_;
97 bool is_ready_; 98 bool is_ready_;
99 base::Timer icon_timeout_timer_;
98 ShortcutInfo shortcut_info_; 100 ShortcutInfo shortcut_info_;
101
102 // The icon must only be set on the UI thread for thread safety.
99 SkBitmap shortcut_icon_; 103 SkBitmap shortcut_icon_;
100 base::CancelableTaskTracker cancelable_task_tracker_; 104 base::CancelableTaskTracker favicon_task_tracker_;
101 105
102 const int preferred_icon_size_in_px_; 106 const int preferred_icon_size_in_px_;
103 static const int kPreferredIconSizeInDp; 107 static const int kPreferredIconSizeInDp;
104 108
105 friend class base::RefCounted<ShortcutDataFetcher>; 109 friend class base::RefCounted<ShortcutDataFetcher>;
106 DISALLOW_COPY_AND_ASSIGN(ShortcutDataFetcher); 110 DISALLOW_COPY_AND_ASSIGN(ShortcutDataFetcher);
107 }; 111 };
108 112
109 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_DATA_FETCHER_H_ 113 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_DATA_FETCHER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/shortcut_data_fetcher.cc » ('j') | chrome/browser/android/shortcut_data_fetcher.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698