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

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

Issue 38523002: Using largest favicon for shortcut when possible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync Created 7 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_HELPER_H_ 5 #ifndef CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_
6 #define CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_ 6 #define CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_
7 7
8 #include "base/android/jni_helper.h" 8 #include "base/android/jni_helper.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 25 matching lines...) Expand all
36 // the shortcut. 36 // the shortcut.
37 class ShortcutBuilder : public content::WebContentsObserver { 37 class ShortcutBuilder : public content::WebContentsObserver {
38 public: 38 public:
39 enum ShortcutType { 39 enum ShortcutType {
40 APP_SHORTCUT, 40 APP_SHORTCUT,
41 APP_SHORTCUT_APPLE, 41 APP_SHORTCUT_APPLE,
42 BOOKMARK 42 BOOKMARK
43 }; 43 };
44 44
45 explicit ShortcutBuilder(content::WebContents* web_contents, 45 explicit ShortcutBuilder(content::WebContents* web_contents,
46 const string16& title); 46 const string16& title,
47 int launcher_large_icon_size);
47 virtual ~ShortcutBuilder() {} 48 virtual ~ShortcutBuilder() {}
48 49
49 void OnDidRetrieveWebappInformation(bool success, 50 void OnDidRetrieveWebappInformation(bool success,
50 bool is_mobile_webapp_capable, 51 bool is_mobile_webapp_capable,
51 bool is_apple_mobile_webapp_capable, 52 bool is_apple_mobile_webapp_capable,
52 const GURL& expected_url); 53 const GURL& expected_url);
53 54
54 void FinishAddingShortcut(const chrome::FaviconBitmapResult& bitmap_result); 55 void FinishAddingShortcut(const chrome::FaviconBitmapResult& bitmap_result);
55 56
56 // WebContentsObserver 57 // WebContentsObserver
57 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 58 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
58 virtual void WebContentsDestroyed(content::WebContents* web_contents) 59 virtual void WebContentsDestroyed(content::WebContents* web_contents)
59 OVERRIDE; 60 OVERRIDE;
60 61
61 private: 62 private:
62 void Destroy(); 63 void Destroy();
63 64
64 GURL url_; 65 GURL url_;
65 string16 title_; 66 string16 title_;
67 int launcher_large_icon_size_;
66 ShortcutType shortcut_type_; 68 ShortcutType shortcut_type_;
67 CancelableTaskTracker cancelable_task_tracker_; 69 CancelableTaskTracker cancelable_task_tracker_;
68 70
69 DISALLOW_COPY_AND_ASSIGN(ShortcutBuilder); 71 DISALLOW_COPY_AND_ASSIGN(ShortcutBuilder);
70 }; 72 };
71 73
72 class ShortcutHelper { 74 class ShortcutHelper {
73 public: 75 public:
74 // Adds a shortcut to the current URL to the Android home screen, firing 76 // Adds a shortcut to the current URL to the Android home screen, firing
75 // background tasks to pull all the data required. 77 // background tasks to pull all the data required.
76 static void AddShortcut(content::WebContents* web_contents, 78 static void AddShortcut(content::WebContents* web_contents,
77 const string16& title); 79 const string16& title,
80 int launcher_larger_icon_size);
78 81
79 // Adds a shortcut to the launcher. Must be called from a WorkerPool task. 82 // Adds a shortcut to the launcher. Must be called from a WorkerPool task.
80 static void AddShortcutInBackground( 83 static void AddShortcutInBackground(
81 const GURL& url, 84 const GURL& url,
82 const base::string16& title, 85 const base::string16& title,
83 ShortcutBuilder::ShortcutType shortcut_type, 86 ShortcutBuilder::ShortcutType shortcut_type,
84 const chrome::FaviconBitmapResult& bitmap_result); 87 const chrome::FaviconBitmapResult& bitmap_result);
85 88
86 // Registers JNI hooks. 89 // Registers JNI hooks.
87 static bool RegisterShortcutHelper(JNIEnv* env); 90 static bool RegisterShortcutHelper(JNIEnv* env);
88 91
89 private: 92 private:
90 DISALLOW_COPY_AND_ASSIGN(ShortcutHelper); 93 DISALLOW_COPY_AND_ASSIGN(ShortcutHelper);
91 }; 94 };
92 95
93 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_ 96 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698