OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/activity_log.h" | 5 #include "chrome/browser/extensions/activity_log.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/json/json_string_value_serializer.h" | 10 #include "base/json/json_string_value_serializer.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
14 #include "chrome/browser/extensions/api_actions.h" | 14 #include "chrome/browser/extensions/api_actions.h" |
15 #include "chrome/browser/extensions/blocked_actions.h" | 15 #include "chrome/browser/extensions/blocked_actions.h" |
16 #include "chrome/browser/extensions/extension_service.h" | 16 #include "chrome/browser/extensions/extension_service.h" |
17 #include "chrome/browser/extensions/extension_system.h" | 17 #include "chrome/browser/extensions/extension_system.h" |
| 18 #include "chrome/browser/profiles/incognito_helpers.h" |
18 #include "chrome/common/chrome_constants.h" | 19 #include "chrome/common/chrome_constants.h" |
19 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
20 #include "chrome/common/extensions/extension.h" | 21 #include "chrome/common/extensions/extension.h" |
21 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
22 #include "googleurl/src/gurl.h" | 23 #include "googleurl/src/gurl.h" |
23 #include "sql/error_delegate_util.h" | 24 #include "sql/error_delegate_util.h" |
24 #include "third_party/re2/re2/re2.h" | 25 #include "third_party/re2/re2/re2.h" |
25 | 26 |
26 namespace { | 27 namespace { |
27 | 28 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 128 |
128 ActivityLogFactory* ActivityLogFactory::GetInstance() { | 129 ActivityLogFactory* ActivityLogFactory::GetInstance() { |
129 return Singleton<ActivityLogFactory>::get(); | 130 return Singleton<ActivityLogFactory>::get(); |
130 } | 131 } |
131 | 132 |
132 ProfileKeyedService* ActivityLogFactory::BuildServiceInstanceFor( | 133 ProfileKeyedService* ActivityLogFactory::BuildServiceInstanceFor( |
133 content::BrowserContext* profile) const { | 134 content::BrowserContext* profile) const { |
134 return new ActivityLog(static_cast<Profile*>(profile)); | 135 return new ActivityLog(static_cast<Profile*>(profile)); |
135 } | 136 } |
136 | 137 |
137 bool ActivityLogFactory::ServiceRedirectedInIncognito() const { | 138 content::BrowserContext* ActivityLogFactory::GetBrowserContextToUse( |
138 return true; | 139 content::BrowserContext* context) const { |
| 140 return chrome::GetBrowserContextRedirectedInIncognito(context); |
139 } | 141 } |
140 | 142 |
141 // ActivityLog | 143 // ActivityLog |
142 | 144 |
143 // Use GetInstance instead of directly creating an ActivityLog. | 145 // Use GetInstance instead of directly creating an ActivityLog. |
144 ActivityLog::ActivityLog(Profile* profile) { | 146 ActivityLog::ActivityLog(Profile* profile) { |
145 // enable-extension-activity-logging and enable-extension-activity-ui | 147 // enable-extension-activity-logging and enable-extension-activity-ui |
146 log_activity_to_stdout_ = CommandLine::ForCurrentProcess()->HasSwitch( | 148 log_activity_to_stdout_ = CommandLine::ForCurrentProcess()->HasSwitch( |
147 switches::kEnableExtensionActivityLogging); | 149 switches::kEnableExtensionActivityLogging); |
148 log_activity_to_ui_ = CommandLine::ForCurrentProcess()->HasSwitch( | 150 log_activity_to_ui_ = CommandLine::ForCurrentProcess()->HasSwitch( |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 return "content_script"; | 499 return "content_script"; |
498 case ActivityLog::ACTIVITY_EVENT_DISPATCH: | 500 case ActivityLog::ACTIVITY_EVENT_DISPATCH: |
499 return "event_dispatch"; | 501 return "event_dispatch"; |
500 default: | 502 default: |
501 NOTREACHED(); | 503 NOTREACHED(); |
502 return ""; | 504 return ""; |
503 } | 505 } |
504 } | 506 } |
505 | 507 |
506 } // namespace extensions | 508 } // namespace extensions |
OLD | NEW |