Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: chrome/browser/extensions/activity_log/activity_log.cc

Issue 21646004: Compressed activity log database storage (Closed) Base URL: http://git.chromium.org/chromium/src.git@refactor-cleanups
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/activity_log.h" 5 #include "chrome/browser/extensions/activity_log/activity_log.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/json/json_string_value_serializer.h" 11 #include "base/json/json_string_value_serializer.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "base/threading/thread_checker.h" 15 #include "base/threading/thread_checker.h"
16 #include "chrome/browser/extensions/activity_log/activity_action_constants.h" 16 #include "chrome/browser/extensions/activity_log/activity_action_constants.h"
17 #include "chrome/browser/extensions/activity_log/counting_policy.h"
17 #include "chrome/browser/extensions/activity_log/stream_noargs_ui_policy.h" 18 #include "chrome/browser/extensions/activity_log/stream_noargs_ui_policy.h"
18 #include "chrome/browser/extensions/api/activity_log_private/activity_log_privat e_api.h" 19 #include "chrome/browser/extensions/api/activity_log_private/activity_log_privat e_api.h"
19 #include "chrome/browser/extensions/extension_service.h" 20 #include "chrome/browser/extensions/extension_service.h"
20 #include "chrome/browser/extensions/extension_system.h" 21 #include "chrome/browser/extensions/extension_system.h"
21 #include "chrome/browser/extensions/extension_system_factory.h" 22 #include "chrome/browser/extensions/extension_system_factory.h"
22 #include "chrome/browser/extensions/extension_tab_util.h" 23 #include "chrome/browser/extensions/extension_tab_util.h"
23 #include "chrome/browser/extensions/install_tracker_factory.h" 24 #include "chrome/browser/extensions/install_tracker_factory.h"
24 #include "chrome/browser/prerender/prerender_manager.h" 25 #include "chrome/browser/prerender/prerender_manager.h"
25 #include "chrome/browser/prerender/prerender_manager_factory.h" 26 #include "chrome/browser/prerender/prerender_manager_factory.h"
26 #include "chrome/browser/profiles/incognito_helpers.h" 27 #include "chrome/browser/profiles/incognito_helpers.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 if (policy_) 235 if (policy_)
235 policy_->Close(); 236 policy_->Close();
236 237
237 switch (policy_type) { 238 switch (policy_type) {
238 case ActivityLogPolicy::POLICY_FULLSTREAM: 239 case ActivityLogPolicy::POLICY_FULLSTREAM:
239 policy_ = new FullStreamUIPolicy(profile_); 240 policy_ = new FullStreamUIPolicy(profile_);
240 break; 241 break;
241 case ActivityLogPolicy::POLICY_NOARGS: 242 case ActivityLogPolicy::POLICY_NOARGS:
242 policy_ = new StreamWithoutArgsUIPolicy(profile_); 243 policy_ = new StreamWithoutArgsUIPolicy(profile_);
243 break; 244 break;
245 case ActivityLogPolicy::POLICY_COUNTS:
246 policy_ = new CountingPolicy(profile_);
247 break;
244 default: 248 default:
245 NOTREACHED(); 249 NOTREACHED();
246 } 250 }
247 policy_type_ = policy_type; 251 policy_type_ = policy_type;
248 } 252 }
249 } 253 }
250 254
251 // Use GetInstance instead of directly creating an ActivityLog. 255 // Use GetInstance instead of directly creating an ActivityLog.
252 ActivityLog::ActivityLog(Profile* profile) 256 ActivityLog::ActivityLog(Profile* profile)
253 : policy_(NULL), 257 : policy_(NULL),
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 tracker_->AddObserver(this); 297 tracker_->AddObserver(this);
294 ChooseDefaultPolicy(); 298 ChooseDefaultPolicy();
295 initialized_ = true; 299 initialized_ = true;
296 } 300 }
297 301
298 void ActivityLog::ChooseDefaultPolicy() { 302 void ActivityLog::ChooseDefaultPolicy() {
299 if (policy_chosen_ || !enabled_) return; 303 if (policy_chosen_ || !enabled_) return;
300 if (testing_mode_) 304 if (testing_mode_)
301 SetDefaultPolicy(ActivityLogPolicy::POLICY_FULLSTREAM); 305 SetDefaultPolicy(ActivityLogPolicy::POLICY_FULLSTREAM);
302 else 306 else
303 SetDefaultPolicy(ActivityLogPolicy::POLICY_NOARGS); 307 SetDefaultPolicy(ActivityLogPolicy::POLICY_COUNTS);
304 } 308 }
305 309
306 void ActivityLog::Shutdown() { 310 void ActivityLog::Shutdown() {
307 if (tracker_) tracker_->RemoveObserver(this); 311 if (tracker_) tracker_->RemoveObserver(this);
308 } 312 }
309 313
310 ActivityLog::~ActivityLog() { 314 ActivityLog::~ActivityLog() {
311 if (policy_) 315 if (policy_)
312 policy_->Close(); 316 policy_->Close();
313 } 317 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 it2 != it->second.end(); 422 it2 != it->second.end();
419 ++it2) { 423 ++it2) {
420 action->mutable_args()->AppendString(*it2); 424 action->mutable_args()->AppendString(*it2);
421 } 425 }
422 LogAction(action); 426 LogAction(action);
423 } 427 }
424 } 428 }
425 } 429 }
426 430
427 } // namespace extensions 431 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698