OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "apps/metrics_names.h" | |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/prefs/pref_change_registrar.h" | 13 #include "base/prefs/pref_change_registrar.h" |
13 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 14 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
14 #include "chrome/browser/favicon/favicon_service.h" | 15 #include "chrome/browser/favicon/favicon_service.h" |
15 #include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h" | 16 #include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h" |
16 #include "chrome/common/cancelable_task_tracker.h" | 17 #include "chrome/common/cancelable_task_tracker.h" |
17 #include "chrome/common/extensions/extension.h" | 18 #include "chrome/common/extensions/extension.h" |
18 #include "chrome/common/extensions/extension_constants.h" | 19 #include "chrome/common/extensions/extension_constants.h" |
19 #include "content/public/browser/notification_observer.h" | 20 #include "content/public/browser/notification_observer.h" |
20 #include "content/public/browser/notification_registrar.h" | 21 #include "content/public/browser/notification_registrar.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 void FillAppDictionary(base::DictionaryValue* value); | 62 void FillAppDictionary(base::DictionaryValue* value); |
62 | 63 |
63 // Create a dictionary value for the given extension. May return NULL, e.g. if | 64 // Create a dictionary value for the given extension. May return NULL, e.g. if |
64 // the given extension is not an app. If non-NULL, the caller assumes | 65 // the given extension is not an app. If non-NULL, the caller assumes |
65 // ownership of the pointer. | 66 // ownership of the pointer. |
66 base::DictionaryValue* GetAppInfo(const extensions::Extension* extension); | 67 base::DictionaryValue* GetAppInfo(const extensions::Extension* extension); |
67 | 68 |
68 // Populate the given dictionary with the web store promo content. | 69 // Populate the given dictionary with the web store promo content. |
69 void FillPromoDictionary(base::DictionaryValue* value); | 70 void FillPromoDictionary(base::DictionaryValue* value); |
70 | 71 |
71 // Callback for the "getApps" message. | |
72 void HandleGetApps(const base::ListValue* args); | |
73 | |
74 // Callback for the "launchApp" message. | |
75 void HandleLaunchApp(const base::ListValue* args); | |
76 | |
77 // Callback for the "setLaunchType" message. | |
78 void HandleSetLaunchType(const base::ListValue* args); | |
79 | |
80 // Callback for the "uninstallApp" message. | |
81 void HandleUninstallApp(const base::ListValue* args); | |
82 | |
83 // Callback for the "createAppShortcut" message. | |
84 void HandleCreateAppShortcut(const base::ListValue* args); | |
85 | |
86 // Callback for the "reorderApps" message. | |
87 void HandleReorderApps(const base::ListValue* args); | |
88 | |
89 // Callback for the "setPageIndex" message. | |
90 void HandleSetPageIndex(const base::ListValue* args); | |
91 | |
92 // Callback for the "saveAppPageName" message. | |
93 void HandleSaveAppPageName(const base::ListValue* args); | |
94 | |
95 // Callback for the "generateAppForLink" message. | |
96 void HandleGenerateAppForLink(const base::ListValue* args); | |
97 | |
98 // Callback for the "recordAppLaunchByURL" message. Takes an escaped URL and a | 72 // Callback for the "recordAppLaunchByURL" message. Takes an escaped URL and a |
99 // launch source (integer), and if the URL represents an app, records the | 73 // launch source (integer), and if the URL represents an app, records the |
100 // action for UMA. | 74 // action for UMA. |
101 void HandleRecordAppLaunchByUrl(const base::ListValue* args); | 75 void HandleRecordAppLaunchByUrl(const base::ListValue* args); |
102 | 76 |
103 // Callback for "stopShowingAppLauncherPromo" message. | 77 // Other registered message callbacks. |
104 void StopShowingAppLauncherPromo(const base::ListValue* args); | 78 void StopShowingAppLauncherPromo(const base::ListValue* args); |
105 | 79 void OnLearnMore(const base::ListValue* args); |
106 // Callback for "closeNotification" message. | |
107 void HandleNotificationClose(const base::ListValue* args); | 80 void HandleNotificationClose(const base::ListValue* args); |
108 | |
109 // Callback for "setNotificationsDisabled" message. | |
110 void HandleSetNotificationsDisabled(const base::ListValue* args); | 81 void HandleSetNotificationsDisabled(const base::ListValue* args); |
82 void HandleGetApps(const base::ListValue* args); | |
83 void HandleLaunchApp(const base::ListValue* args); | |
84 void HandleSetLaunchType(const base::ListValue* args); | |
85 void HandleUninstallApp(const base::ListValue* args); | |
86 void HandleCreateAppShortcut(const base::ListValue* args); | |
87 void HandleReorderApps(const base::ListValue* args); | |
88 void HandleSetPageIndex(const base::ListValue* args); | |
89 void HandleSaveAppPageName(const base::ListValue* args); | |
90 void HandleGenerateAppForLink(const base::ListValue* args); | |
Dan Beam
2013/06/27 00:59:31
nit: in theory these should mention which args wil
MAD
2013/06/27 21:43:35
Done.
| |
111 | 91 |
112 // Register app launcher preferences. | 92 // Register app launcher preferences. |
113 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry); | 93 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry); |
114 | 94 |
115 // Records the given type of app launch for UMA. | 95 // Records the given type of app launch for UMA. |
116 static void RecordAppLaunchType(extension_misc::AppLaunchBucket bucket, | 96 static void RecordAppLaunchType(extension_misc::AppLaunchBucket bucket, |
117 extensions::Manifest::Type app_type); | 97 extensions::Manifest::Type app_type); |
118 | 98 |
119 // Records an app launch from the search view of the app list. | 99 // Records an app launch from the search view of the app list. |
120 static void RecordAppListSearchLaunch(const extensions::Extension* extension); | 100 static void RecordAppListSearchLaunch(const extensions::Extension* extension); |
121 | 101 |
122 // Records an app launch from the main view of the app list. | 102 // Records an app launch from the main view of the app list. |
123 static void RecordAppListMainLaunch(const extensions::Extension* extension); | 103 static void RecordAppListMainLaunch(const extensions::Extension* extension); |
124 | 104 |
105 static void RecordAppLauncherPromoHistogram( | |
106 apps::AppLauncherPromoHistogramValues histogram); | |
Ilya Sherman
2013/06/26 22:19:49
nit: Docs?
Ilya Sherman
2013/06/26 22:19:49
nit: "histogram" is a misleading variable name her
MAD
2013/06/27 21:43:35
Done.
MAD
2013/06/27 21:43:35
Done.
| |
107 | |
125 private: | 108 private: |
126 struct AppInstallInfo { | 109 struct AppInstallInfo { |
127 AppInstallInfo(); | 110 AppInstallInfo(); |
128 ~AppInstallInfo(); | 111 ~AppInstallInfo(); |
129 | 112 |
130 bool is_bookmark_app; | 113 bool is_bookmark_app; |
131 string16 title; | 114 string16 title; |
132 GURL app_url; | 115 GURL app_url; |
133 syncer::StringOrdinal page_ordinal; | 116 syncer::StringOrdinal page_ordinal; |
134 }; | 117 }; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 // when the app is added to the page (via getAppsCallback or appAdded). | 197 // when the app is added to the page (via getAppsCallback or appAdded). |
215 std::string highlight_app_id_; | 198 std::string highlight_app_id_; |
216 | 199 |
217 // Used for favicon loading tasks. | 200 // Used for favicon loading tasks. |
218 CancelableTaskTracker cancelable_task_tracker_; | 201 CancelableTaskTracker cancelable_task_tracker_; |
219 | 202 |
220 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); | 203 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); |
221 }; | 204 }; |
222 | 205 |
223 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ | 206 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ |
OLD | NEW |