| 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 <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "apps/metrics_names.h" | |
| 13 #include "base/macros.h" | 12 #include "base/macros.h" |
| 14 #include "base/task/cancelable_task_tracker.h" | 13 #include "base/task/cancelable_task_tracker.h" |
| 15 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 14 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
| 16 #include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h" | 15 #include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h" |
| 17 #include "chrome/common/extensions/extension_constants.h" | 16 #include "chrome/common/extensions/extension_constants.h" |
| 18 #include "components/favicon/core/favicon_service.h" | 17 #include "components/favicon/core/favicon_service.h" |
| 19 #include "components/prefs/pref_change_registrar.h" | 18 #include "components/prefs/pref_change_registrar.h" |
| 20 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
| 21 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
| 22 #include "content/public/browser/web_ui_message_handler.h" | 21 #include "content/public/browser/web_ui_message_handler.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 void HandleSetPageIndex(const base::ListValue* args); | 123 void HandleSetPageIndex(const base::ListValue* args); |
| 125 | 124 |
| 126 // Handles "saveAppPageName" message with |args| containing [name, | 125 // Handles "saveAppPageName" message with |args| containing [name, |
| 127 // page_index]. | 126 // page_index]. |
| 128 void HandleSaveAppPageName(const base::ListValue* args); | 127 void HandleSaveAppPageName(const base::ListValue* args); |
| 129 | 128 |
| 130 // Handles "generateAppForLink" message with |args| containing [url, title, | 129 // Handles "generateAppForLink" message with |args| containing [url, title, |
| 131 // page_index]. | 130 // page_index]. |
| 132 void HandleGenerateAppForLink(const base::ListValue* args); | 131 void HandleGenerateAppForLink(const base::ListValue* args); |
| 133 | 132 |
| 134 // Handles "stopShowingAppLauncherPromo" message with unused |args|. | |
| 135 void HandleStopShowingAppLauncherPromo(const base::ListValue* args); | |
| 136 | |
| 137 // Handles "learnMore" message with unused |args|. | |
| 138 void HandleOnLearnMore(const base::ListValue* args); | |
| 139 | |
| 140 // Handles "pageSelected" message with |args| containing [page_index]. | 133 // Handles "pageSelected" message with |args| containing [page_index]. |
| 141 void HandlePageSelected(const base::ListValue* args); | 134 void HandlePageSelected(const base::ListValue* args); |
| 142 | 135 |
| 143 private: | 136 private: |
| 144 struct AppInstallInfo { | 137 struct AppInstallInfo { |
| 145 AppInstallInfo(); | 138 AppInstallInfo(); |
| 146 ~AppInstallInfo(); | 139 ~AppInstallInfo(); |
| 147 | 140 |
| 148 base::string16 title; | 141 base::string16 title; |
| 149 GURL app_url; | 142 GURL app_url; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 170 | 163 |
| 171 // Continuation for installing a bookmark app after favicon lookup. | 164 // Continuation for installing a bookmark app after favicon lookup. |
| 172 void OnFaviconForApp(std::unique_ptr<AppInstallInfo> install_info, | 165 void OnFaviconForApp(std::unique_ptr<AppInstallInfo> install_info, |
| 173 const favicon_base::FaviconImageResult& image_result); | 166 const favicon_base::FaviconImageResult& image_result); |
| 174 | 167 |
| 175 // Sends |highlight_app_id_| to the js. | 168 // Sends |highlight_app_id_| to the js. |
| 176 void SetAppToBeHighlighted(); | 169 void SetAppToBeHighlighted(); |
| 177 | 170 |
| 178 void OnExtensionPreferenceChanged(); | 171 void OnExtensionPreferenceChanged(); |
| 179 | 172 |
| 180 void OnLocalStatePreferenceChanged(); | |
| 181 | |
| 182 // Called when an app is removed (unloaded or uninstalled). Updates the UI. | 173 // Called when an app is removed (unloaded or uninstalled). Updates the UI. |
| 183 void AppRemoved(const extensions::Extension* extension, bool is_uninstall); | 174 void AppRemoved(const extensions::Extension* extension, bool is_uninstall); |
| 184 | 175 |
| 185 // True if the extension should be displayed. | 176 // True if the extension should be displayed. |
| 186 bool ShouldShow(const extensions::Extension* extension) const; | 177 bool ShouldShow(const extensions::Extension* extension) const; |
| 187 | 178 |
| 188 // The apps are represented in the extensions model, which | 179 // The apps are represented in the extensions model, which |
| 189 // outlives us since it's owned by our containing profile. | 180 // outlives us since it's owned by our containing profile. |
| 190 ExtensionService* const extension_service_; | 181 ExtensionService* const extension_service_; |
| 191 | 182 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 // when the app is added to the page (via getAppsCallback or appAdded). | 220 // when the app is added to the page (via getAppsCallback or appAdded). |
| 230 std::string highlight_app_id_; | 221 std::string highlight_app_id_; |
| 231 | 222 |
| 232 // Used for favicon loading tasks. | 223 // Used for favicon loading tasks. |
| 233 base::CancelableTaskTracker cancelable_task_tracker_; | 224 base::CancelableTaskTracker cancelable_task_tracker_; |
| 234 | 225 |
| 235 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); | 226 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); |
| 236 }; | 227 }; |
| 237 | 228 |
| 238 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ | 229 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ |
| OLD | NEW |