Chromium Code Reviews| 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 // Handles the "launchApp" message with unused |args|. |
| 72 void HandleGetApps(const base::ListValue* args); | 73 void HandleGetApps(const base::ListValue* args); |
| 73 | 74 |
| 74 // Callback for the "launchApp" message. | 75 // Handles the "launchApp" message with |args| containing [extension_id, |
| 76 // source] with optional [url, disposition], |disposition| defaulting to | |
| 77 // CURRENT_TAB. | |
| 75 void HandleLaunchApp(const base::ListValue* args); | 78 void HandleLaunchApp(const base::ListValue* args); |
| 76 | 79 |
| 77 // Callback for the "setLaunchType" message. | 80 // Handles the "setLaunchType" message with args containing [extension_id, |
| 81 // launch_type]. | |
| 78 void HandleSetLaunchType(const base::ListValue* args); | 82 void HandleSetLaunchType(const base::ListValue* args); |
| 79 | 83 |
| 80 // Callback for the "uninstallApp" message. | 84 // Handles the "uninstallApp" message with |args| containing [extension_id] |
| 85 // and an optional bool to not confirm the uninstall when true, defaults to | |
| 86 // false. | |
| 81 void HandleUninstallApp(const base::ListValue* args); | 87 void HandleUninstallApp(const base::ListValue* args); |
| 82 | 88 |
| 83 // Callback for the "createAppShortcut" message. | 89 // Handles the "createAppShortcut" message with |args| containing |
| 90 // [extension_id]. | |
| 84 void HandleCreateAppShortcut(const base::ListValue* args); | 91 void HandleCreateAppShortcut(const base::ListValue* args); |
| 85 | 92 |
| 86 // Callback for the "reorderApps" message. | 93 // Handles the "reorderApps" message with |args| containing [dragged_app_id, |
| 94 // app_order]. | |
| 87 void HandleReorderApps(const base::ListValue* args); | 95 void HandleReorderApps(const base::ListValue* args); |
| 88 | 96 |
| 89 // Callback for the "setPageIndex" message. | 97 // Handles the "setPageIndex" message with |args| containing [extension_id, |
| 98 // page_index]. | |
| 90 void HandleSetPageIndex(const base::ListValue* args); | 99 void HandleSetPageIndex(const base::ListValue* args); |
| 91 | 100 |
| 92 // Callback for the "saveAppPageName" message. | 101 // Handles "saveAppPageName" message with |args| containing [name, |
| 102 // page_index]. | |
| 93 void HandleSaveAppPageName(const base::ListValue* args); | 103 void HandleSaveAppPageName(const base::ListValue* args); |
| 94 | 104 |
| 95 // Callback for the "generateAppForLink" message. | 105 // Handles "generateAppForLink" message with |args| containing [url, title, |
| 106 // page_index]. | |
| 96 void HandleGenerateAppForLink(const base::ListValue* args); | 107 void HandleGenerateAppForLink(const base::ListValue* args); |
| 97 | 108 |
| 98 // Callback for the "recordAppLaunchByURL" message. Takes an escaped URL and a | 109 // Callback for the "recordAppLaunchByURL" message. Takes an escaped URL and a |
| 99 // launch source (integer), and if the URL represents an app, records the | 110 // launch source (integer), and if the URL represents an app, records the |
| 100 // action for UMA. | 111 // action for UMA. |
| 101 void HandleRecordAppLaunchByUrl(const base::ListValue* args); | 112 void HandleRecordAppLaunchByUrl(const base::ListValue* args); |
| 102 | 113 |
| 103 // Callback for "stopShowingAppLauncherPromo" message. | 114 // Other registered message callbacks with unused |args|. |
| 104 void StopShowingAppLauncherPromo(const base::ListValue* args); | 115 void StopShowingAppLauncherPromo(const base::ListValue* args); |
| 105 | 116 void OnLearnMore(const base::ListValue* args); |
| 106 // Callback for "closeNotification" message. | |
| 107 void HandleNotificationClose(const base::ListValue* args); | |
| 108 | |
| 109 // Callback for "setNotificationsDisabled" message. | |
| 110 void HandleSetNotificationsDisabled(const base::ListValue* args); | |
|
MAD
2013/06/27 21:43:35
Those last two were not in the implementation anym
| |
| 111 | 117 |
| 112 // Register app launcher preferences. | 118 // Register app launcher preferences. |
| 113 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry); | 119 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry); |
| 114 | 120 |
| 115 // Records the given type of app launch for UMA. | 121 // Records the given type of app launch for UMA. |
| 116 static void RecordAppLaunchType(extension_misc::AppLaunchBucket bucket, | 122 static void RecordAppLaunchType(extension_misc::AppLaunchBucket bucket, |
| 117 extensions::Manifest::Type app_type); | 123 extensions::Manifest::Type app_type); |
| 118 | 124 |
| 119 // Records an app launch from the search view of the app list. | 125 // Records an app launch from the search view of the app list. |
| 120 static void RecordAppListSearchLaunch(const extensions::Extension* extension); | 126 static void RecordAppListSearchLaunch(const extensions::Extension* extension); |
| 121 | 127 |
| 122 // Records an app launch from the main view of the app list. | 128 // Records an app launch from the main view of the app list. |
| 123 static void RecordAppListMainLaunch(const extensions::Extension* extension); | 129 static void RecordAppListMainLaunch(const extensions::Extension* extension); |
| 124 | 130 |
| 131 // Records the given |value| in the apps::kAppLauncherPromoHistogram. | |
| 132 static void RecordAppLauncherPromoHistogram( | |
| 133 apps::AppLauncherPromoHistogramValues value); | |
| 134 | |
| 125 private: | 135 private: |
| 126 struct AppInstallInfo { | 136 struct AppInstallInfo { |
| 127 AppInstallInfo(); | 137 AppInstallInfo(); |
| 128 ~AppInstallInfo(); | 138 ~AppInstallInfo(); |
| 129 | 139 |
| 130 bool is_bookmark_app; | 140 bool is_bookmark_app; |
| 131 string16 title; | 141 string16 title; |
| 132 GURL app_url; | 142 GURL app_url; |
| 133 syncer::StringOrdinal page_ordinal; | 143 syncer::StringOrdinal page_ordinal; |
| 134 }; | 144 }; |
| (...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). | 224 // when the app is added to the page (via getAppsCallback or appAdded). |
| 215 std::string highlight_app_id_; | 225 std::string highlight_app_id_; |
| 216 | 226 |
| 217 // Used for favicon loading tasks. | 227 // Used for favicon loading tasks. |
| 218 CancelableTaskTracker cancelable_task_tracker_; | 228 CancelableTaskTracker cancelable_task_tracker_; |
| 219 | 229 |
| 220 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); | 230 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); |
| 221 }; | 231 }; |
| 222 | 232 |
| 223 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ | 233 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ |
| OLD | NEW |