OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s
ampling.h" | 5 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s
ampling.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
11 #include "chrome/common/extensions/api/experience_sampling_private.h" | 11 #include "chrome/common/extensions/api/experience_sampling_private.h" |
12 #include "extensions/browser/event_router.h" | 12 #include "extensions/browser/event_router.h" |
13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
14 | 14 |
15 namespace extensions { | 15 namespace extensions { |
16 | 16 |
17 // static | 17 // static |
18 const char ExperienceSamplingEvent::kProceed[] = "proceed"; | 18 const char ExperienceSamplingEvent::kProceed[] = "proceed"; |
19 const char ExperienceSamplingEvent::kDeny[] = "deny"; | 19 const char ExperienceSamplingEvent::kDeny[] = "deny"; |
| 20 const char ExperienceSamplingEvent::kIgnore[] = "ignore"; |
20 const char ExperienceSamplingEvent::kCancel[] = "cancel"; | 21 const char ExperienceSamplingEvent::kCancel[] = "cancel"; |
21 const char ExperienceSamplingEvent::kReload[] = "reload"; | 22 const char ExperienceSamplingEvent::kReload[] = "reload"; |
22 | 23 |
23 // static | 24 // static |
| 25 const char ExperienceSamplingEvent::kMaliciousDownload[] = |
| 26 "download_warning_malicious"; |
| 27 const char ExperienceSamplingEvent::kDangerousDownload[] = |
| 28 "download_warning_dangerous"; |
| 29 const char ExperienceSamplingEvent::kDownloadDangerPrompt[] = |
| 30 "download_danger_prompt"; |
24 const char ExperienceSamplingEvent::kExtensionInstallDialog[] = | 31 const char ExperienceSamplingEvent::kExtensionInstallDialog[] = |
25 "extension_install_dialog_"; | 32 "extension_install_dialog_"; |
26 | 33 |
27 // static | 34 // static |
28 scoped_ptr<ExperienceSamplingEvent> ExperienceSamplingEvent::Create( | 35 scoped_ptr<ExperienceSamplingEvent> ExperienceSamplingEvent::Create( |
29 const std::string& element_name, | 36 const std::string& element_name, |
30 const GURL& destination, | 37 const GURL& destination, |
31 const GURL& referrer) { | 38 const GURL& referrer) { |
32 Profile* profile = NULL; | 39 Profile* profile = NULL; |
33 if (g_browser_process->profile_manager()) | 40 if (g_browser_process->profile_manager()) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 scoped_ptr<base::ListValue> args(new base::ListValue()); | 98 scoped_ptr<base::ListValue> args(new base::ListValue()); |
92 args->Append(ui_element_.ToValue().release()); | 99 args->Append(ui_element_.ToValue().release()); |
93 scoped_ptr<Event> event(new Event( | 100 scoped_ptr<Event> event(new Event( |
94 api::experience_sampling_private::OnDisplayed::kEventName, args.Pass())); | 101 api::experience_sampling_private::OnDisplayed::kEventName, args.Pass())); |
95 EventRouter* router = EventRouter::Get(browser_context_); | 102 EventRouter* router = EventRouter::Get(browser_context_); |
96 if (router) | 103 if (router) |
97 router->BroadcastEvent(event.Pass()); | 104 router->BroadcastEvent(event.Pass()); |
98 } | 105 } |
99 | 106 |
100 } // namespace extensions | 107 } // namespace extensions |
OLD | NEW |