| 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 #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 Loading... |
| 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_; |
| 98 bool is_icon_saved_; |
| 97 bool is_ready_; | 99 bool is_ready_; |
| 100 base::Timer icon_timeout_timer_; |
| 98 ShortcutInfo shortcut_info_; | 101 ShortcutInfo shortcut_info_; |
| 102 |
| 103 // The icon must only be set on the UI thread for thread safety. |
| 99 SkBitmap shortcut_icon_; | 104 SkBitmap shortcut_icon_; |
| 100 base::CancelableTaskTracker cancelable_task_tracker_; | 105 base::CancelableTaskTracker favicon_task_tracker_; |
| 101 | 106 |
| 102 const int preferred_icon_size_in_px_; | 107 const int preferred_icon_size_in_px_; |
| 103 static const int kPreferredIconSizeInDp; | 108 static const int kPreferredIconSizeInDp; |
| 104 | 109 |
| 105 friend class base::RefCounted<ShortcutDataFetcher>; | 110 friend class base::RefCounted<ShortcutDataFetcher>; |
| 106 DISALLOW_COPY_AND_ASSIGN(ShortcutDataFetcher); | 111 DISALLOW_COPY_AND_ASSIGN(ShortcutDataFetcher); |
| 107 }; | 112 }; |
| 108 | 113 |
| 109 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_DATA_FETCHER_H_ | 114 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_DATA_FETCHER_H_ |
| OLD | NEW |