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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_CORE_APP_LAUNCHER_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_NTP_CORE_APP_LAUNCHER_HANDLER_H_
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/values.h"
13 #include "chrome/common/extensions/extension.h"
14 #include "chrome/common/extensions/extension_constants.h"
15 #include "content/public/browser/web_ui_message_handler.h"
17 namespace extensions {
21 namespace user_prefs {
22 class PrefRegistrySyncable;
27 class CoreAppLauncherHandler : public content::WebUIMessageHandler {
29 CoreAppLauncherHandler();
30 virtual ~CoreAppLauncherHandler();
32 // Records the given type of app launch for UMA.
33 static void RecordAppLaunchType(extension_misc::AppLaunchBucket bucket,
34 extensions::Manifest::Type app_type);
36 // Register app launcher preferences.
37 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
39 // Records an app launch from the search view of the app list.
40 static void RecordAppListSearchLaunch(const extensions::Extension* extension);
42 // Records an app launch from the main view of the app list.
43 static void RecordAppListMainLaunch(const extensions::Extension* extension);
45 // Records a web store launch in the appropriate histograms.
46 static void RecordWebStoreLaunch();
49 // Callback for the "recordAppLaunchByUrl" message. Takes an escaped URL and
50 // a launch source(integer), and if the URL represents an app, records the
52 void HandleRecordAppLaunchByUrl(const base::ListValue* args);
54 // Records an app launch in the corresponding |bucket| of the app launch
55 // histogram if the |escaped_url| corresponds to an installed app.
56 void RecordAppLaunchByUrl(Profile* profile,
57 std::string escaped_url,
58 extension_misc::AppLaunchBucket bucket);
60 // WebUIMessageHandler implementation.
61 virtual void RegisterMessages() OVERRIDE;
63 DISALLOW_COPY_AND_ASSIGN(CoreAppLauncherHandler);
66 #endif // CHROME_BROWSER_UI_WEBUI_NTP_CORE_APP_LAUNCHER_HANDLER_H_