| 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 "base/timer/timer.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // refcounted to prevent the class from being prematurely deleted. If the | 31 // refcounted to prevent the class from being prematurely deleted. If the |
| 32 // pointer to the ShortcutHelper becomes invalid, the pipeline should kill | 32 // pointer to the ShortcutHelper becomes invalid, the pipeline should kill |
| 33 // itself. | 33 // itself. |
| 34 class ShortcutDataFetcher | 34 class ShortcutDataFetcher |
| 35 : public base::RefCounted<ShortcutDataFetcher>, | 35 : public base::RefCounted<ShortcutDataFetcher>, |
| 36 public content::WebContentsObserver { | 36 public content::WebContentsObserver { |
| 37 public: | 37 public: |
| 38 class Observer { | 38 class Observer { |
| 39 public: | 39 public: |
| 40 // Called when the title of the page is available. | 40 // Called when the title of the page is available. |
| 41 virtual void OnTitleAvailable(const base::string16& title) = 0; | 41 virtual void OnUserTitleAvailable(const base::string16& title) = 0; |
| 42 | 42 |
| 43 // Converts the icon into one that can be used on the Android Home screen. | 43 // Converts the icon into one that can be used on the Android Home screen. |
| 44 virtual SkBitmap FinalizeLauncherIcon(const SkBitmap& icon, | 44 virtual SkBitmap FinalizeLauncherIcon(const SkBitmap& icon, |
| 45 const GURL& url) = 0; | 45 const GURL& url) = 0; |
| 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 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 base::CancelableTaskTracker favicon_task_tracker_; | 105 base::CancelableTaskTracker favicon_task_tracker_; |
| 106 | 106 |
| 107 const int preferred_icon_size_in_px_; | 107 const int preferred_icon_size_in_px_; |
| 108 static const int kPreferredIconSizeInDp; | 108 static const int kPreferredIconSizeInDp; |
| 109 | 109 |
| 110 friend class base::RefCounted<ShortcutDataFetcher>; | 110 friend class base::RefCounted<ShortcutDataFetcher>; |
| 111 DISALLOW_COPY_AND_ASSIGN(ShortcutDataFetcher); | 111 DISALLOW_COPY_AND_ASSIGN(ShortcutDataFetcher); |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_DATA_FETCHER_H_ | 114 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_DATA_FETCHER_H_ |
| OLD | NEW |