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

Side by Side Diff: chrome/browser/extensions/api/developer_private/developer_private_api.cc

Issue 1201063002: Set up the infrastructure for Extension event metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaaaaase Created 5 years, 6 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) 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 #include "chrome/browser/extensions/api/developer_private/developer_private_api. h" 5 #include "chrome/browser/extensions/api/developer_private/developer_private_api. h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 } 334 }
335 335
336 void DeveloperPrivateEventRouter::OnExtensionDisableReasonsChanged( 336 void DeveloperPrivateEventRouter::OnExtensionDisableReasonsChanged(
337 const std::string& extension_id, int disable_reasons) { 337 const std::string& extension_id, int disable_reasons) {
338 BroadcastItemStateChanged(developer::EVENT_TYPE_PREFS_CHANGED, extension_id); 338 BroadcastItemStateChanged(developer::EVENT_TYPE_PREFS_CHANGED, extension_id);
339 } 339 }
340 340
341 void DeveloperPrivateEventRouter::OnExtensionManagementSettingsChanged() { 341 void DeveloperPrivateEventRouter::OnExtensionManagementSettingsChanged() {
342 scoped_ptr<base::ListValue> args(new base::ListValue()); 342 scoped_ptr<base::ListValue> args(new base::ListValue());
343 args->Append(CreateProfileInfo(profile_)->ToValue()); 343 args->Append(CreateProfileInfo(profile_)->ToValue());
344 scoped_ptr<Event> event(new Event( 344 scoped_ptr<Event> event(
345 developer::OnProfileStateChanged::kEventName, args.Pass())); 345 new Event(events::UNKNOWN, developer::OnProfileStateChanged::kEventName,
346 args.Pass()));
346 event_router_->BroadcastEvent(event.Pass()); 347 event_router_->BroadcastEvent(event.Pass());
347 } 348 }
348 349
349 void DeveloperPrivateEventRouter::ExtensionWarningsChanged( 350 void DeveloperPrivateEventRouter::ExtensionWarningsChanged(
350 const ExtensionIdSet& affected_extensions) { 351 const ExtensionIdSet& affected_extensions) {
351 for (const ExtensionId& id : affected_extensions) 352 for (const ExtensionId& id : affected_extensions)
352 BroadcastItemStateChanged(developer::EVENT_TYPE_WARNINGS_CHANGED, id); 353 BroadcastItemStateChanged(developer::EVENT_TYPE_WARNINGS_CHANGED, id);
353 } 354 }
354 355
355 void DeveloperPrivateEventRouter::BroadcastItemStateChanged( 356 void DeveloperPrivateEventRouter::BroadcastItemStateChanged(
(...skipping 28 matching lines...) Expand all
384 // extension info, but since it's an optional field, it's implemented as a 385 // extension info, but since it's an optional field, it's implemented as a
385 // scoped ptr, and so ownership between that and the vector of linked ptrs 386 // scoped ptr, and so ownership between that and the vector of linked ptrs
386 // here is, well, messy. Easier to just set it like this. 387 // here is, well, messy. Easier to just set it like this.
387 dict->SetWithoutPathExpansion("extensionInfo", 388 dict->SetWithoutPathExpansion("extensionInfo",
388 infos[0]->ToValue().release()); 389 infos[0]->ToValue().release());
389 } 390 }
390 391
391 scoped_ptr<base::ListValue> args(new base::ListValue()); 392 scoped_ptr<base::ListValue> args(new base::ListValue());
392 args->Append(dict.release()); 393 args->Append(dict.release());
393 scoped_ptr<Event> event(new Event( 394 scoped_ptr<Event> event(new Event(
394 developer::OnItemStateChanged::kEventName, args.Pass())); 395 events::UNKNOWN, developer::OnItemStateChanged::kEventName, args.Pass()));
395 event_router_->BroadcastEvent(event.Pass()); 396 event_router_->BroadcastEvent(event.Pass());
396 } 397 }
397 398
398 void DeveloperPrivateAPI::SetLastUnpackedDirectory(const base::FilePath& path) { 399 void DeveloperPrivateAPI::SetLastUnpackedDirectory(const base::FilePath& path) {
399 last_unpacked_directory_ = path; 400 last_unpacked_directory_ = path;
400 } 401 }
401 402
402 void DeveloperPrivateAPI::RegisterNotifications() { 403 void DeveloperPrivateAPI::RegisterNotifications() {
403 EventRouter::Get(profile_)->RegisterObserver( 404 EventRouter::Get(profile_)->RegisterObserver(
404 this, developer::OnItemStateChanged::kEventName); 405 this, developer::OnItemStateChanged::kEventName);
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 update.extension_id, update.command_name, *update.keybinding); 1432 update.extension_id, update.command_name, *update.keybinding);
1432 } 1433 }
1433 1434
1434 return RespondNow(NoArguments()); 1435 return RespondNow(NoArguments());
1435 } 1436 }
1436 1437
1437 1438
1438 } // namespace api 1439 } // namespace api
1439 1440
1440 } // namespace extensions 1441 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/debugger/debugger_api.cc ('k') | chrome/browser/extensions/api/dial/dial_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698