summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc22
-rw-r--r--chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h6
-rw-r--r--chrome/browser/extensions/api/bookmarks/bookmarks_api.cc22
-rw-r--r--chrome/browser/extensions/api/bookmarks/bookmarks_api.h3
-rw-r--r--chrome/browser/extensions/api/braille_display_private/braille_display_private_api.cc8
-rw-r--r--chrome/browser/extensions/api/cookies/cookies_api.cc41
-rw-r--r--chrome/browser/extensions/api/cookies/cookies_api.h14
-rw-r--r--chrome/browser/extensions/api/copresence/copresence_api.cc16
-rw-r--r--chrome/browser/extensions/api/debugger/debugger_api.cc4
-rw-r--r--chrome/browser/extensions/api/developer_private/developer_private_api.cc9
-rw-r--r--chrome/browser/extensions/api/dial/dial_api.cc9
-rw-r--r--chrome/browser/extensions/api/downloads/downloads_api.cc26
-rw-r--r--chrome/browser/extensions/api/downloads/downloads_api.h1
-rw-r--r--chrome/browser/extensions/api/experience_sampling_private/experience_sampling.cc6
-rw-r--r--chrome/browser/extensions/api/extension_action/extension_action_api.cc15
-rw-r--r--chrome/browser/extensions/api/extension_action/extension_action_api.h2
-rw-r--r--chrome/browser/extensions/api/feedback_private/feedback_private_api.cc4
-rw-r--r--chrome/browser/extensions/api/file_system/file_system_api.cc67
-rw-r--r--chrome/browser/extensions/api/file_system/file_system_api.h24
-rw-r--r--chrome/browser/extensions/api/gcd_private/gcd_private_api.cc6
-rw-r--r--chrome/browser/extensions/api/gcm/gcm_api.cc10
-rw-r--r--chrome/browser/extensions/api/history/history_api.cc24
-rw-r--r--chrome/browser/extensions/api/history/history_api.h1
-rw-r--r--chrome/browser/extensions/api/hotword_private/hotword_private_api.cc42
-rw-r--r--chrome/browser/extensions/api/hotword_private/hotword_private_api.h7
-rw-r--r--extensions/browser/extension_event_histogram_value.h2
-rw-r--r--tools/metrics/histograms/histograms.xml2
27 files changed, 210 insertions, 183 deletions
diff --git a/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc b/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc
index 9e86725..640cd00 100644
--- a/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc
+++ b/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc
@@ -184,11 +184,12 @@ BookmarkManagerPrivateEventRouter::~BookmarkManagerPrivateEventRouter() {
}
void BookmarkManagerPrivateEventRouter::DispatchEvent(
+ events::HistogramValue histogram_value,
const std::string& event_name,
scoped_ptr<base::ListValue> event_args) {
- extensions::EventRouter::Get(browser_context_)
- ->BroadcastEvent(make_scoped_ptr(new extensions::Event(
- extensions::events::UNKNOWN, event_name, event_args.Pass())));
+ EventRouter::Get(browser_context_)
+ ->BroadcastEvent(make_scoped_ptr(
+ new Event(histogram_value, event_name, event_args.Pass())));
}
void BookmarkManagerPrivateEventRouter::BookmarkModelChanged() {}
@@ -242,7 +243,8 @@ void BookmarkManagerPrivateEventRouter::BookmarkMetaInfoChanged(
}
prev_meta_info_.clear();
- DispatchEvent(bookmark_manager_private::OnMetaInfoChanged::kEventName,
+ DispatchEvent(events::BOOKMARK_MANAGER_PRIVATE_ON_META_INFO_CHANGED,
+ bookmark_manager_private::OnMetaInfoChanged::kEventName,
bookmark_manager_private::OnMetaInfoChanged::Create(
base::Int64ToString(node->id()), changes));
}
@@ -298,13 +300,14 @@ BookmarkManagerPrivateDragEventRouter::
}
void BookmarkManagerPrivateDragEventRouter::DispatchEvent(
+ events::HistogramValue histogram_value,
const std::string& event_name,
scoped_ptr<base::ListValue> args) {
EventRouter* event_router = EventRouter::Get(profile_);
if (!event_router)
return;
- scoped_ptr<Event> event(new Event(events::UNKNOWN, event_name, args.Pass()));
+ scoped_ptr<Event> event(new Event(histogram_value, event_name, args.Pass()));
event_router->BroadcastEvent(event.Pass());
}
@@ -312,7 +315,8 @@ void BookmarkManagerPrivateDragEventRouter::OnDragEnter(
const BookmarkNodeData& data) {
if (!data.is_valid())
return;
- DispatchEvent(bookmark_manager_private::OnDragEnter::kEventName,
+ DispatchEvent(events::BOOKMARK_MANAGER_PRIVATE_ON_DRAG_ENTER,
+ bookmark_manager_private::OnDragEnter::kEventName,
bookmark_manager_private::OnDragEnter::Create(
*CreateApiBookmarkNodeData(profile_, data)));
}
@@ -327,7 +331,8 @@ void BookmarkManagerPrivateDragEventRouter::OnDragLeave(
const BookmarkNodeData& data) {
if (!data.is_valid())
return;
- DispatchEvent(bookmark_manager_private::OnDragLeave::kEventName,
+ DispatchEvent(events::BOOKMARK_MANAGER_PRIVATE_ON_DRAG_LEAVE,
+ bookmark_manager_private::OnDragLeave::kEventName,
bookmark_manager_private::OnDragLeave::Create(
*CreateApiBookmarkNodeData(profile_, data)));
}
@@ -336,7 +341,8 @@ void BookmarkManagerPrivateDragEventRouter::OnDrop(
const BookmarkNodeData& data) {
if (!data.is_valid())
return;
- DispatchEvent(bookmark_manager_private::OnDrop::kEventName,
+ DispatchEvent(events::BOOKMARK_MANAGER_PRIVATE_ON_DROP,
+ bookmark_manager_private::OnDrop::kEventName,
bookmark_manager_private::OnDrop::Create(
*CreateApiBookmarkNodeData(profile_, data)));
diff --git a/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h b/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h
index 67ca9dc..a5d93d3 100644
--- a/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h
+++ b/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h
@@ -48,7 +48,8 @@ class BookmarkManagerPrivateEventRouter
private:
// Helper to actually dispatch an event to extension listeners.
- void DispatchEvent(const std::string& event_name,
+ void DispatchEvent(events::HistogramValue histogram_value,
+ const std::string& event_name,
scoped_ptr<base::ListValue> event_args);
// Remembers the previous meta info of a node before it was changed.
@@ -111,7 +112,8 @@ class BookmarkManagerPrivateDragEventRouter
private:
// Helper to actually dispatch an event to extension listeners.
- void DispatchEvent(const std::string& event_name,
+ void DispatchEvent(events::HistogramValue histogram_value,
+ const std::string& event_name,
scoped_ptr<base::ListValue> args);
Profile* profile_;
diff --git a/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc
index 8db4a81..4fe297f 100644
--- a/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc
+++ b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc
@@ -254,12 +254,13 @@ BookmarkEventRouter::~BookmarkEventRouter() {
}
void BookmarkEventRouter::DispatchEvent(
+ events::HistogramValue histogram_value,
const std::string& event_name,
scoped_ptr<base::ListValue> event_args) {
EventRouter* event_router = EventRouter::Get(browser_context_);
if (event_router) {
- event_router->BroadcastEvent(make_scoped_ptr(new extensions::Event(
- extensions::events::UNKNOWN, event_name, event_args.Pass())));
+ event_router->BroadcastEvent(make_scoped_ptr(
+ new extensions::Event(histogram_value, event_name, event_args.Pass())));
}
}
@@ -286,7 +287,7 @@ void BookmarkEventRouter::BookmarkNodeMoved(BookmarkModel* model,
move_info.old_index = old_index;
DispatchEvent(
- bookmarks::OnMoved::kEventName,
+ events::BOOKMARKS_ON_MOVED, bookmarks::OnMoved::kEventName,
bookmarks::OnMoved::Create(base::Int64ToString(node->id()), move_info));
}
@@ -296,7 +297,7 @@ void BookmarkEventRouter::BookmarkNodeAdded(BookmarkModel* model,
const BookmarkNode* node = parent->GetChild(index);
scoped_ptr<BookmarkTreeNode> tree_node(
bookmark_api_helpers::GetBookmarkTreeNode(client_, node, false, false));
- DispatchEvent(bookmarks::OnCreated::kEventName,
+ DispatchEvent(events::BOOKMARKS_ON_CREATED, bookmarks::OnCreated::kEventName,
bookmarks::OnCreated::Create(base::Int64ToString(node->id()),
*tree_node));
}
@@ -311,7 +312,7 @@ void BookmarkEventRouter::BookmarkNodeRemoved(
remove_info.parent_id = base::Int64ToString(parent->id());
remove_info.index = index;
- DispatchEvent(bookmarks::OnRemoved::kEventName,
+ DispatchEvent(events::BOOKMARKS_ON_REMOVED, bookmarks::OnRemoved::kEventName,
bookmarks::OnRemoved::Create(base::Int64ToString(node->id()),
remove_info));
}
@@ -337,7 +338,7 @@ void BookmarkEventRouter::BookmarkNodeChanged(BookmarkModel* model,
if (node->is_url())
change_info.url.reset(new std::string(node->url().spec()));
- DispatchEvent(bookmarks::OnChanged::kEventName,
+ DispatchEvent(events::BOOKMARKS_ON_CHANGED, bookmarks::OnChanged::kEventName,
bookmarks::OnChanged::Create(base::Int64ToString(node->id()),
change_info));
}
@@ -357,19 +358,22 @@ void BookmarkEventRouter::BookmarkNodeChildrenReordered(
reorder_info.child_ids.push_back(base::Int64ToString(child->id()));
}
- DispatchEvent(bookmarks::OnChildrenReordered::kEventName,
+ DispatchEvent(events::BOOKMARKS_ON_CHILDREN_REORDERED,
+ bookmarks::OnChildrenReordered::kEventName,
bookmarks::OnChildrenReordered::Create(
base::Int64ToString(node->id()), reorder_info));
}
void BookmarkEventRouter::ExtensiveBookmarkChangesBeginning(
BookmarkModel* model) {
- DispatchEvent(bookmarks::OnImportBegan::kEventName,
+ DispatchEvent(events::BOOKMARKS_ON_IMPORT_BEGAN,
+ bookmarks::OnImportBegan::kEventName,
bookmarks::OnImportBegan::Create());
}
void BookmarkEventRouter::ExtensiveBookmarkChangesEnded(BookmarkModel* model) {
- DispatchEvent(bookmarks::OnImportEnded::kEventName,
+ DispatchEvent(events::BOOKMARKS_ON_IMPORT_ENDED,
+ bookmarks::OnImportEnded::kEventName,
bookmarks::OnImportEnded::Create());
}
diff --git a/chrome/browser/extensions/api/bookmarks/bookmarks_api.h b/chrome/browser/extensions/api/bookmarks/bookmarks_api.h
index 9c3f082..2ea2857 100644
--- a/chrome/browser/extensions/api/bookmarks/bookmarks_api.h
+++ b/chrome/browser/extensions/api/bookmarks/bookmarks_api.h
@@ -76,7 +76,8 @@ class BookmarkEventRouter : public bookmarks::BookmarkModelObserver {
private:
// Helper to actually dispatch an event to extension listeners.
- void DispatchEvent(const std::string& event_name,
+ void DispatchEvent(events::HistogramValue histogram_value,
+ const std::string& event_name,
scoped_ptr<base::ListValue> event_args);
content::BrowserContext* browser_context_;
diff --git a/chrome/browser/extensions/api/braille_display_private/braille_display_private_api.cc b/chrome/browser/extensions/api/braille_display_private/braille_display_private_api.cc
index cd8e56e..5a5ef77 100644
--- a/chrome/browser/extensions/api/braille_display_private/braille_display_private_api.cc
+++ b/chrome/browser/extensions/api/braille_display_private/braille_display_private_api.cc
@@ -63,7 +63,8 @@ BrailleDisplayPrivateAPI::GetFactoryInstance() {
void BrailleDisplayPrivateAPI::OnBrailleDisplayStateChanged(
const DisplayState& display_state) {
scoped_ptr<Event> event(
- new Event(events::UNKNOWN, OnDisplayStateChanged::kEventName,
+ new Event(events::BRAILLE_DISPLAY_PRIVATE_ON_DISPLAY_STATE_CHANGED,
+ OnDisplayStateChanged::kEventName,
OnDisplayStateChanged::Create(display_state)));
event_delegate_->BroadcastEvent(event.Pass());
}
@@ -72,8 +73,9 @@ void BrailleDisplayPrivateAPI::OnBrailleKeyEvent(const KeyEvent& key_event) {
// Key events only go to extensions of the active profile.
if (!IsProfileActive())
return;
- scoped_ptr<Event> event(new Event(events::UNKNOWN, OnKeyEvent::kEventName,
- OnKeyEvent::Create(key_event)));
+ scoped_ptr<Event> event(
+ new Event(events::BRAILLE_DISPLAY_PRIVATE_ON_KEY_EVENT,
+ OnKeyEvent::kEventName, OnKeyEvent::Create(key_event)));
event_delegate_->BroadcastEvent(event.Pass());
}
diff --git a/chrome/browser/extensions/api/cookies/cookies_api.cc b/chrome/browser/extensions/api/cookies/cookies_api.cc
index 14acc20..e91b1fc 100644
--- a/chrome/browser/extensions/api/cookies/cookies_api.cc
+++ b/chrome/browser/extensions/api/cookies/cookies_api.cc
@@ -35,18 +35,16 @@
#include "net/url_request/url_request_context_getter.h"
using content::BrowserThread;
-using extensions::api::cookies::Cookie;
-using extensions::api::cookies::CookieStore;
-
-namespace Get = extensions::api::cookies::Get;
-namespace GetAll = extensions::api::cookies::GetAll;
-namespace GetAllCookieStores = extensions::api::cookies::GetAllCookieStores;
-namespace Remove = extensions::api::cookies::Remove;
-namespace Set = extensions::api::cookies::Set;
namespace extensions {
+
namespace cookies = api::cookies;
namespace keys = cookies_api_constants;
+namespace Get = cookies::Get;
+namespace GetAll = cookies::GetAll;
+namespace GetAllCookieStores = cookies::GetAllCookieStores;
+namespace Remove = cookies::Remove;
+namespace Set = cookies::Set;
namespace {
@@ -143,9 +141,8 @@ void CookiesEventRouter::CookieChanged(
base::DictionaryValue* dict = new base::DictionaryValue();
dict->SetBoolean(keys::kRemovedKey, details->removed);
- scoped_ptr<Cookie> cookie(
- cookies_helpers::CreateCookie(*details->cookie,
- cookies_helpers::GetStoreIdFromProfile(profile)));
+ scoped_ptr<cookies::Cookie> cookie(cookies_helpers::CreateCookie(
+ *details->cookie, cookies_helpers::GetStoreIdFromProfile(profile)));
dict->Set(keys::kCookieKey, cookie->ToValue().release());
// Map the internal cause to an external string.
@@ -180,21 +177,20 @@ void CookiesEventRouter::CookieChanged(
GURL cookie_domain =
cookies_helpers::GetURLFromCanonicalCookie(*details->cookie);
- DispatchEvent(profile,
- cookies::OnChanged::kEventName,
- args.Pass(),
- cookie_domain);
+ DispatchEvent(profile, events::COOKIES_ON_CHANGED,
+ cookies::OnChanged::kEventName, args.Pass(), cookie_domain);
}
void CookiesEventRouter::DispatchEvent(content::BrowserContext* context,
+ events::HistogramValue histogram_value,
const std::string& event_name,
scoped_ptr<base::ListValue> event_args,
GURL& cookie_domain) {
- EventRouter* router = context ? extensions::EventRouter::Get(context) : NULL;
+ EventRouter* router = context ? EventRouter::Get(context) : NULL;
if (!router)
return;
scoped_ptr<Event> event(
- new Event(events::UNKNOWN, event_name, event_args.Pass()));
+ new Event(histogram_value, event_name, event_args.Pass()));
event->restrict_to_browser_context = context;
event->event_url = cookie_domain;
router->BroadcastEvent(event.Pass());
@@ -251,7 +247,7 @@ void CookiesGetFunction::GetCookieCallback(const net::CookieList& cookie_list) {
// CookieMonster returns them in canonical order (longest path, then
// earliest creation time).
if (it->Name() == parsed_args_->details.name) {
- scoped_ptr<Cookie> cookie(
+ scoped_ptr<cookies::Cookie> cookie(
cookies_helpers::CreateCookie(*it, *parsed_args_->details.store_id));
results_ = Get::Results::Create(*cookie);
break;
@@ -319,7 +315,7 @@ void CookiesGetAllFunction::GetAllCookiesOnIOThread() {
void CookiesGetAllFunction::GetAllCookiesCallback(
const net::CookieList& cookie_list) {
if (extension()) {
- std::vector<linked_ptr<Cookie> > match_vector;
+ std::vector<linked_ptr<cookies::Cookie>> match_vector;
cookies_helpers::AppendMatchingCookiesToVector(
cookie_list, url_, &parsed_args_->details, extension(), &match_vector);
@@ -431,7 +427,7 @@ void CookiesSetFunction::PullCookieCallback(
parsed_args_->details.name.get() ? *parsed_args_->details.name
: std::string();
if (it->Name() == name) {
- scoped_ptr<Cookie> cookie(
+ scoped_ptr<cookies::Cookie> cookie(
cookies_helpers::CreateCookie(*it, *parsed_args_->details.store_id));
results_ = Set::Results::Create(*cookie);
break;
@@ -546,7 +542,7 @@ bool CookiesGetAllCookieStoresFunction::RunSync() {
}
}
// Return a list of all cookie stores with at least one open tab.
- std::vector<linked_ptr<CookieStore> > cookie_stores;
+ std::vector<linked_ptr<cookies::CookieStore>> cookie_stores;
if (original_tab_ids->GetSize() > 0) {
cookie_stores.push_back(make_linked_ptr(
cookies_helpers::CreateCookieStore(
@@ -583,8 +579,7 @@ BrowserContextKeyedAPIFactory<CookiesAPI>* CookiesAPI::GetFactoryInstance() {
return g_factory.Pointer();
}
-void CookiesAPI::OnListenerAdded(
- const extensions::EventListenerInfo& details) {
+void CookiesAPI::OnListenerAdded(const EventListenerInfo& details) {
cookies_event_router_.reset(new CookiesEventRouter(browser_context_));
EventRouter::Get(browser_context_)->UnregisterObserver(this);
}
diff --git a/chrome/browser/extensions/api/cookies/cookies_api.h b/chrome/browser/extensions/api/cookies/cookies_api.h
index 30e2c30..0ee1180 100644
--- a/chrome/browser/extensions/api/cookies/cookies_api.h
+++ b/chrome/browser/extensions/api/cookies/cookies_api.h
@@ -48,6 +48,7 @@ class CookiesEventRouter : public content::NotificationObserver {
// This method dispatches events to the extension message service.
void DispatchEvent(content::BrowserContext* context,
+ events::HistogramValue histogram_value,
const std::string& event_name,
scoped_ptr<base::ListValue> event_args,
GURL& cookie_domain);
@@ -80,7 +81,7 @@ class CookiesGetFunction : public ChromeAsyncExtensionFunction {
GURL url_;
scoped_refptr<net::URLRequestContextGetter> store_browser_context_;
- scoped_ptr<extensions::api::cookies::Get::Params> parsed_args_;
+ scoped_ptr<api::cookies::Get::Params> parsed_args_;
};
// Implements the cookies.getAll() extension function.
@@ -103,7 +104,7 @@ class CookiesGetAllFunction : public ChromeAsyncExtensionFunction {
GURL url_;
scoped_refptr<net::URLRequestContextGetter> store_browser_context_;
- scoped_ptr<extensions::api::cookies::GetAll::Params> parsed_args_;
+ scoped_ptr<api::cookies::GetAll::Params> parsed_args_;
};
// Implements the cookies.set() extension function.
@@ -126,7 +127,7 @@ class CookiesSetFunction : public ChromeAsyncExtensionFunction {
GURL url_;
bool success_;
scoped_refptr<net::URLRequestContextGetter> store_browser_context_;
- scoped_ptr<extensions::api::cookies::Set::Params> parsed_args_;
+ scoped_ptr<api::cookies::Set::Params> parsed_args_;
};
// Implements the cookies.remove() extension function.
@@ -149,7 +150,7 @@ class CookiesRemoveFunction : public ChromeAsyncExtensionFunction {
GURL url_;
scoped_refptr<net::URLRequestContextGetter> store_browser_context_;
- scoped_ptr<extensions::api::cookies::Remove::Params> parsed_args_;
+ scoped_ptr<api::cookies::Remove::Params> parsed_args_;
};
// Implements the cookies.getAllCookieStores() extension function.
@@ -165,8 +166,7 @@ class CookiesGetAllCookieStoresFunction : public ChromeSyncExtensionFunction {
bool RunSync() override;
};
-class CookiesAPI : public BrowserContextKeyedAPI,
- public extensions::EventRouter::Observer {
+class CookiesAPI : public BrowserContextKeyedAPI, public EventRouter::Observer {
public:
explicit CookiesAPI(content::BrowserContext* context);
~CookiesAPI() override;
@@ -178,7 +178,7 @@ class CookiesAPI : public BrowserContextKeyedAPI,
static BrowserContextKeyedAPIFactory<CookiesAPI>* GetFactoryInstance();
// EventRouter::Observer implementation.
- void OnListenerAdded(const extensions::EventListenerInfo& details) override;
+ void OnListenerAdded(const EventListenerInfo& details) override;
private:
friend class BrowserContextKeyedAPIFactory<CookiesAPI>;
diff --git a/chrome/browser/extensions/api/copresence/copresence_api.cc b/chrome/browser/extensions/api/copresence/copresence_api.cc
index c47530e..e32e0c8 100644
--- a/chrome/browser/extensions/api/copresence/copresence_api.cc
+++ b/chrome/browser/extensions/api/copresence/copresence_api.cc
@@ -147,10 +147,10 @@ void CopresenceService::HandleMessages(
}
// Send the messages to the client app.
- scoped_ptr<Event> event(
- new Event(events::UNKNOWN, OnMessagesReceived::kEventName,
- OnMessagesReceived::Create(subscription_id, api_messages),
- browser_context_));
+ scoped_ptr<Event> event(new Event(
+ events::COPRESENCE_ON_MESSAGES_RECEIVED, OnMessagesReceived::kEventName,
+ OnMessagesReceived::Create(subscription_id, api_messages),
+ browser_context_));
EventRouter::Get(browser_context_)
->DispatchEventToExtension(app_id, event.Pass());
DVLOG(2) << "Passed " << api_messages.size() << " messages to app \""
@@ -160,10 +160,10 @@ void CopresenceService::HandleMessages(
void CopresenceService::HandleStatusUpdate(
copresence::CopresenceStatus status) {
DCHECK_EQ(copresence::AUDIO_FAIL, status);
- scoped_ptr<Event> event(
- new Event(events::UNKNOWN, OnStatusUpdated::kEventName,
- OnStatusUpdated::Create(api::copresence::STATUS_AUDIOFAILED),
- browser_context_));
+ scoped_ptr<Event> event(new Event(
+ events::COPRESENCE_ON_STATUS_UPDATED, OnStatusUpdated::kEventName,
+ OnStatusUpdated::Create(api::copresence::STATUS_AUDIOFAILED),
+ browser_context_));
EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass());
DVLOG(2) << "Sent Audio Failed status update.";
}
diff --git a/chrome/browser/extensions/api/debugger/debugger_api.cc b/chrome/browser/extensions/api/debugger/debugger_api.cc
index ee5d0ff3..7579503 100644
--- a/chrome/browser/extensions/api/debugger/debugger_api.cc
+++ b/chrome/browser/extensions/api/debugger/debugger_api.cc
@@ -400,7 +400,7 @@ void ExtensionDevToolsClientHost::SendDetachedEvent() {
scoped_ptr<base::ListValue> args(OnDetach::Create(debuggee_,
detach_reason_));
scoped_ptr<Event> event(
- new Event(events::UNKNOWN, OnDetach::kEventName, args.Pass()));
+ new Event(events::DEBUGGER_ON_DETACH, OnDetach::kEventName, args.Pass()));
event->restrict_to_browser_context = profile_;
EventRouter::Get(profile_)
->DispatchEventToExtension(extension_id_, event.Pass());
@@ -461,7 +461,7 @@ void ExtensionDevToolsClientHost::DispatchProtocolMessage(
scoped_ptr<base::ListValue> args(
OnEvent::Create(debuggee_, method_name, params));
scoped_ptr<Event> event(
- new Event(events::UNKNOWN, OnEvent::kEventName, args.Pass()));
+ new Event(events::DEBUGGER_ON_EVENT, OnEvent::kEventName, args.Pass()));
event->restrict_to_browser_context = profile_;
EventRouter::Get(profile_)
->DispatchEventToExtension(extension_id_, event.Pass());
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
index 66d3eb5..13b8e3a 100644
--- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc
+++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
@@ -341,8 +341,8 @@ void DeveloperPrivateEventRouter::OnExtensionManagementSettingsChanged() {
scoped_ptr<base::ListValue> args(new base::ListValue());
args->Append(CreateProfileInfo(profile_)->ToValue());
scoped_ptr<Event> event(
- new Event(events::UNKNOWN, developer::OnProfileStateChanged::kEventName,
- args.Pass()));
+ new Event(events::DEVELOPER_PRIVATE_ON_PROFILE_STATE_CHANGED,
+ developer::OnProfileStateChanged::kEventName, args.Pass()));
event_router_->BroadcastEvent(event.Pass());
}
@@ -390,8 +390,9 @@ void DeveloperPrivateEventRouter::BroadcastItemStateChangedHelper(
scoped_ptr<base::ListValue> args(new base::ListValue());
args->Append(dict.release());
- scoped_ptr<Event> event(new Event(
- events::UNKNOWN, developer::OnItemStateChanged::kEventName, args.Pass()));
+ scoped_ptr<Event> event(
+ new Event(events::DEVELOPER_PRIVATE_ON_ITEM_STATE_CHANGED,
+ developer::OnItemStateChanged::kEventName, args.Pass()));
event_router_->BroadcastEvent(event.Pass());
}
diff --git a/chrome/browser/extensions/api/dial/dial_api.cc b/chrome/browser/extensions/api/dial/dial_api.cc
index 3e3dd17..cc9f1c6 100644
--- a/chrome/browser/extensions/api/dial/dial_api.cc
+++ b/chrome/browser/extensions/api/dial/dial_api.cc
@@ -105,8 +105,9 @@ void DialAPI::SendEventOnUIThread(const DialRegistry::DeviceList& devices) {
args.push_back(api_device);
}
scoped_ptr<base::ListValue> results = api::dial::OnDeviceList::Create(args);
- scoped_ptr<Event> event(new Event(
- events::UNKNOWN, dial::OnDeviceList::kEventName, results.Pass()));
+ scoped_ptr<Event> event(new Event(events::DIAL_ON_DEVICE_LIST,
+ dial::OnDeviceList::kEventName,
+ results.Pass()));
EventRouter::Get(profile_)->BroadcastEvent(event.Pass());
}
@@ -136,8 +137,8 @@ void DialAPI::SendErrorOnUIThread(const DialRegistry::DialErrorCode code) {
}
scoped_ptr<base::ListValue> results = api::dial::OnError::Create(dial_error);
- scoped_ptr<Event> event(
- new Event(events::UNKNOWN, dial::OnError::kEventName, results.Pass()));
+ scoped_ptr<Event> event(new Event(events::DIAL_ON_ERROR,
+ dial::OnError::kEventName, results.Pass()));
EventRouter::Get(profile_)->BroadcastEvent(event.Pass());
}
diff --git a/chrome/browser/extensions/api/downloads/downloads_api.cc b/chrome/browser/extensions/api/downloads/downloads_api.cc
index 4e3bc13c..b1fde95 100644
--- a/chrome/browser/extensions/api/downloads/downloads_api.cc
+++ b/chrome/browser/extensions/api/downloads/downloads_api.cc
@@ -1592,11 +1592,10 @@ void ExtensionDownloadsEventRouter::OnDeterminingFilename(
base::DictionaryValue* json = DownloadItemToJSON(
item, profile_).release();
json->SetString(kFilenameKey, suggested_path.LossyDisplayName());
- DispatchEvent(downloads::OnDeterminingFilename::kEventName,
- false,
+ DispatchEvent(events::DOWNLOADS_ON_DETERMINING_FILENAME,
+ downloads::OnDeterminingFilename::kEventName, false,
base::Bind(&OnDeterminingFilenameWillDispatchCallback,
- &any_determiners,
- data),
+ &any_determiners, data),
json);
if (!any_determiners) {
data->ClearPendingDeterminers();
@@ -1757,10 +1756,8 @@ void ExtensionDownloadsEventRouter::OnDownloadCreated(
}
scoped_ptr<base::DictionaryValue> json_item(
DownloadItemToJSON(download_item, profile_));
- DispatchEvent(downloads::OnCreated::kEventName,
- true,
- Event::WillDispatchCallback(),
- json_item->DeepCopy());
+ DispatchEvent(events::DOWNLOADS_ON_CREATED, downloads::OnCreated::kEventName,
+ true, Event::WillDispatchCallback(), json_item->DeepCopy());
if (!ExtensionDownloadsEventRouterData::Get(download_item) &&
(router->HasEventListener(downloads::OnChanged::kEventName) ||
router->HasEventListener(
@@ -1829,10 +1826,9 @@ void ExtensionDownloadsEventRouter::OnDownloadUpdated(
// changed. Replace the stored json with the new json.
data->OnItemUpdated();
if (changed) {
- DispatchEvent(downloads::OnChanged::kEventName,
- true,
- Event::WillDispatchCallback(),
- delta.release());
+ DispatchEvent(events::DOWNLOADS_ON_CHANGED,
+ downloads::OnChanged::kEventName, true,
+ Event::WillDispatchCallback(), delta.release());
data->OnChangedFired();
}
data->set_json(new_json.Pass());
@@ -1844,13 +1840,13 @@ void ExtensionDownloadsEventRouter::OnDownloadRemoved(
if (download_item->IsTemporary())
return;
DispatchEvent(
- downloads::OnErased::kEventName,
- true,
+ events::DOWNLOADS_ON_ERASED, downloads::OnErased::kEventName, true,
Event::WillDispatchCallback(),
new base::FundamentalValue(static_cast<int>(download_item->GetId())));
}
void ExtensionDownloadsEventRouter::DispatchEvent(
+ events::HistogramValue histogram_value,
const std::string& event_name,
bool include_incognito,
const Event::WillDispatchCallback& will_dispatch_callback,
@@ -1862,7 +1858,7 @@ void ExtensionDownloadsEventRouter::DispatchEvent(
args->Append(arg);
std::string json_args;
base::JSONWriter::Write(*args, &json_args);
- scoped_ptr<Event> event(new Event(events::UNKNOWN, event_name, args.Pass()));
+ scoped_ptr<Event> event(new Event(histogram_value, event_name, args.Pass()));
// The downloads system wants to share on-record events with off-record
// extension renderers even in incognito_split_mode because that's how
// chrome://downloads works. The "restrict_to_profile" mechanism does not
diff --git a/chrome/browser/extensions/api/downloads/downloads_api.h b/chrome/browser/extensions/api/downloads/downloads_api.h
index abd4e48..6d514a7 100644
--- a/chrome/browser/extensions/api/downloads/downloads_api.h
+++ b/chrome/browser/extensions/api/downloads/downloads_api.h
@@ -383,6 +383,7 @@ class ExtensionDownloadsEventRouter
private:
void DispatchEvent(
+ events::HistogramValue histogram_value,
const std::string& event_name,
bool include_incognito,
const extensions::Event::WillDispatchCallback& will_dispatch_callback,
diff --git a/chrome/browser/extensions/api/experience_sampling_private/experience_sampling.cc b/chrome/browser/extensions/api/experience_sampling_private/experience_sampling.cc
index e7d5908..8a62c9c 100644
--- a/chrome/browser/extensions/api/experience_sampling_private/experience_sampling.cc
+++ b/chrome/browser/extensions/api/experience_sampling_private/experience_sampling.cc
@@ -84,8 +84,8 @@ void ExperienceSamplingEvent::CreateUserDecisionEvent(
args->Append(ui_element_.ToValue().release());
args->Append(decision.ToValue().release());
scoped_ptr<Event> event(new Event(
- events::UNKNOWN, api::experience_sampling_private::OnDecision::kEventName,
- args.Pass()));
+ events::EXPERIENCE_SAMPLING_PRIVATE_ON_DECISION,
+ api::experience_sampling_private::OnDecision::kEventName, args.Pass()));
EventRouter* router = EventRouter::Get(browser_context_);
if (router)
router->BroadcastEvent(event.Pass());
@@ -99,7 +99,7 @@ void ExperienceSamplingEvent::CreateOnDisplayedEvent() {
scoped_ptr<base::ListValue> args(new base::ListValue());
args->Append(ui_element_.ToValue().release());
scoped_ptr<Event> event(new Event(
- events::UNKNOWN,
+ events::EXPERIENCE_SAMPLING_PRIVATE_ON_DISPLAYED,
api::experience_sampling_private::OnDisplayed::kEventName, args.Pass()));
EventRouter* router = EventRouter::Get(browser_context_);
if (router)
diff --git a/chrome/browser/extensions/api/extension_action/extension_action_api.cc b/chrome/browser/extensions/api/extension_action/extension_action_api.cc
index 917d42d..aac3d31 100644
--- a/chrome/browser/extensions/api/extension_action/extension_action_api.cc
+++ b/chrome/browser/extensions/api/extension_action/extension_action_api.cc
@@ -300,13 +300,14 @@ ExtensionPrefs* ExtensionActionAPI::GetExtensionPrefs() {
void ExtensionActionAPI::DispatchEventToExtension(
content::BrowserContext* context,
const std::string& extension_id,
+ events::HistogramValue histogram_value,
const std::string& event_name,
scoped_ptr<base::ListValue> event_args) {
if (!EventRouter::Get(context))
return;
scoped_ptr<Event> event(
- new Event(events::UNKNOWN, event_name, event_args.Pass()));
+ new Event(histogram_value, event_name, event_args.Pass()));
event->restrict_to_browser_context = context;
event->user_gesture = EventRouter::USER_GESTURE_ENABLED;
EventRouter::Get(context)
@@ -316,16 +317,20 @@ void ExtensionActionAPI::DispatchEventToExtension(
void ExtensionActionAPI::ExtensionActionExecuted(
const ExtensionAction& extension_action,
WebContents* web_contents) {
+ events::HistogramValue histogram_value = events::UNKNOWN;
const char* event_name = NULL;
switch (extension_action.action_type()) {
case ActionInfo::TYPE_BROWSER:
+ histogram_value = events::BROWSER_ACTION_ON_CLICKED;
event_name = "browserAction.onClicked";
break;
case ActionInfo::TYPE_PAGE:
+ histogram_value = events::PAGE_ACTION_ON_CLICKED;
event_name = "pageAction.onClicked";
break;
case ActionInfo::TYPE_SYSTEM_INDICATOR:
// The System Indicator handles its own clicks.
+ NOTREACHED();
break;
}
@@ -335,11 +340,9 @@ void ExtensionActionAPI::ExtensionActionExecuted(
ExtensionTabUtil::CreateTabValue(web_contents);
args->Append(tab_value);
- DispatchEventToExtension(
- web_contents->GetBrowserContext(),
- extension_action.extension_id(),
- event_name,
- args.Pass());
+ DispatchEventToExtension(web_contents->GetBrowserContext(),
+ extension_action.extension_id(), histogram_value,
+ event_name, args.Pass());
}
}
diff --git a/chrome/browser/extensions/api/extension_action/extension_action_api.h b/chrome/browser/extensions/api/extension_action/extension_action_api.h
index 61ab75b..079b890 100644
--- a/chrome/browser/extensions/api/extension_action/extension_action_api.h
+++ b/chrome/browser/extensions/api/extension_action/extension_action_api.h
@@ -13,6 +13,7 @@
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
+#include "extensions/browser/extension_event_histogram_value.h"
#include "third_party/skia/include/core/SkColor.h"
namespace base {
@@ -125,6 +126,7 @@ class ExtensionActionAPI : public BrowserContextKeyedAPI {
// The DispatchEvent methods forward events to the |context|'s event router.
void DispatchEventToExtension(content::BrowserContext* context,
const std::string& extension_id,
+ events::HistogramValue histogram_value,
const std::string& event_name,
scoped_ptr<base::ListValue> event_args);
diff --git a/chrome/browser/extensions/api/feedback_private/feedback_private_api.cc b/chrome/browser/extensions/api/feedback_private/feedback_private_api.cc
index ad56efd..ae82f7a 100644
--- a/chrome/browser/extensions/api/feedback_private/feedback_private_api.cc
+++ b/chrome/browser/extensions/api/feedback_private/feedback_private_api.cc
@@ -89,8 +89,8 @@ void FeedbackPrivateAPI::RequestFeedback(
args->Append(info.ToValue().release());
scoped_ptr<Event> event(new Event(
- events::UNKNOWN, feedback_private::OnFeedbackRequested::kEventName,
- args.Pass()));
+ events::FEEDBACK_PRIVATE_ON_FEEDBACK_REQUESTED,
+ feedback_private::OnFeedbackRequested::kEventName, args.Pass()));
event->restrict_to_browser_context = browser_context_;
EventRouter::Get(browser_context_)
diff --git a/chrome/browser/extensions/api/file_system/file_system_api.cc b/chrome/browser/extensions/api/file_system/file_system_api.cc
index 68f8cab..3f033d4 100644
--- a/chrome/browser/extensions/api/file_system/file_system_api.cc
+++ b/chrome/browser/extensions/api/file_system/file_system_api.cc
@@ -117,7 +117,9 @@ const char* const kRequestFileSystemComponentWhitelist[] = {
};
#endif
-namespace file_system = extensions::api::file_system;
+namespace extensions {
+
+namespace file_system = api::file_system;
namespace ChooseEntry = file_system::ChooseEntry;
namespace {
@@ -233,7 +235,7 @@ content::WebContents* GetWebContentsForRenderFrameHost(
content::WebContents::FromRenderFrameHost(render_frame_host);
// Check if there is an app window associated with the web contents; if not,
// return null.
- return extensions::AppWindowRegistry::Get(profile)
+ return AppWindowRegistry::Get(profile)
->GetAppWindowForWebContents(web_contents)
? web_contents
: nullptr;
@@ -244,23 +246,20 @@ content::WebContents* GetWebContentsForRenderFrameHost(
// with |app_id|. If not found, then returns NULL.
content::WebContents* GetWebContentsForAppId(Profile* profile,
const std::string& app_id) {
- extensions::AppWindowRegistry* const registry =
- extensions::AppWindowRegistry::Get(profile);
+ AppWindowRegistry* const registry = AppWindowRegistry::Get(profile);
DCHECK(registry);
- extensions::AppWindow* const app_window =
- registry->GetCurrentAppWindowForApp(app_id);
+ AppWindow* const app_window = registry->GetCurrentAppWindowForApp(app_id);
return app_window ? app_window->web_contents() : nullptr;
}
// Fills a list of volumes mounted in the system.
-void FillVolumeList(
- Profile* profile,
- std::vector<linked_ptr<extensions::api::file_system::Volume>>* result) {
+void FillVolumeList(Profile* profile,
+ std::vector<linked_ptr<api::file_system::Volume>>* result) {
using file_manager::VolumeManager;
VolumeManager* const volume_manager = VolumeManager::Get(profile);
DCHECK(volume_manager);
- using extensions::api::file_system::Volume;
+ using api::file_system::Volume;
const auto& volume_list = volume_manager->GetVolumeList();
// Convert volume_list to result_volume_list.
for (const auto& volume : volume_list) {
@@ -274,8 +273,6 @@ void FillVolumeList(
} // namespace
-namespace extensions {
-
namespace file_system_api {
base::FilePath GetLastChooseEntryDirectory(const ExtensionPrefs* prefs,
@@ -315,14 +312,13 @@ void DispatchVolumeListChangeEvent(Profile* profile) {
if (!event_router) // Possible on shutdown.
return;
- extensions::ExtensionRegistry* const registry =
- extensions::ExtensionRegistry::Get(profile);
+ ExtensionRegistry* const registry = ExtensionRegistry::Get(profile);
if (!registry) // Possible on shutdown.
return;
ConsentProviderDelegate consent_provider_delegate(profile, nullptr);
ConsentProvider consent_provider(&consent_provider_delegate);
- extensions::api::file_system::VolumeListChangedEvent event_args;
+ api::file_system::VolumeListChangedEvent event_args;
FillVolumeList(profile, &event_args.volumes);
for (const auto& extension : registry->enabled_extensions()) {
if (!consent_provider.IsGrantable(*extension.get()))
@@ -330,10 +326,9 @@ void DispatchVolumeListChangeEvent(Profile* profile) {
event_router->DispatchEventToExtension(
extension->id(),
make_scoped_ptr(new Event(
- events::UNKNOWN,
- extensions::api::file_system::OnVolumeListChanged::kEventName,
- extensions::api::file_system::OnVolumeListChanged::Create(
- event_args))));
+ events::FILE_SYSTEM_ON_VOLUME_LIST_CHANGED,
+ api::file_system::OnVolumeListChanged::kEventName,
+ api::file_system::OnVolumeListChanged::Create(event_args))));
}
}
@@ -346,7 +341,7 @@ ConsentProvider::~ConsentProvider() {
}
void ConsentProvider::RequestConsent(
- const extensions::Extension& extension,
+ const Extension& extension,
const base::WeakPtr<file_manager::Volume>& volume,
bool writable,
const ConsentCallback& callback) {
@@ -424,7 +419,7 @@ void ConsentProviderDelegate::SetAutoDialogButtonForTest(
}
void ConsentProviderDelegate::ShowDialog(
- const extensions::Extension& extension,
+ const Extension& extension,
const base::WeakPtr<file_manager::Volume>& volume,
bool writable,
const file_system_api::ConsentProvider::ShowDialogCallback& callback) {
@@ -456,22 +451,21 @@ void ConsentProviderDelegate::ShowDialog(
}
void ConsentProviderDelegate::ShowNotification(
- const extensions::Extension& extension,
+ const Extension& extension,
const base::WeakPtr<file_manager::Volume>& volume,
bool writable) {
RequestFileSystemNotification::ShowAutoGrantedNotification(
profile_, extension, volume, writable);
}
-bool ConsentProviderDelegate::IsAutoLaunched(
- const extensions::Extension& extension) {
+bool ConsentProviderDelegate::IsAutoLaunched(const Extension& extension) {
chromeos::KioskAppManager::App app_info;
return chromeos::KioskAppManager::Get()->GetApp(extension.id(), &app_info) &&
app_info.was_auto_launched_with_zero_delay;
}
bool ConsentProviderDelegate::IsWhitelistedComponent(
- const extensions::Extension& extension) {
+ const Extension& extension) {
for (const auto& whitelisted_id : kRequestFileSystemComponentWhitelist) {
if (extension.id().compare(whitelisted_id) == 0)
return true;
@@ -1145,8 +1139,7 @@ bool FileSystemRetainEntryFunction::RunAsync() {
if (!storage::CrackIsolatedFileSystemName(filesystem_name, &filesystem_id))
return false;
- const GURL site =
- extensions::util::GetSiteForExtensionId(extension_id(), GetProfile());
+ const GURL site = util::GetSiteForExtensionId(extension_id(), GetProfile());
storage::FileSystemContext* const context =
content::BrowserContext::GetStoragePartitionForSite(GetProfile(), site)
->GetFileSystemContext();
@@ -1250,7 +1243,7 @@ bool FileSystemGetObservedEntriesFunction::RunSync() {
#if !defined(OS_CHROMEOS)
ExtensionFunction::ResponseAction FileSystemRequestFileSystemFunction::Run() {
- using extensions::api::file_system::RequestFileSystem::Params;
+ using api::file_system::RequestFileSystem::Params;
const scoped_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
@@ -1272,7 +1265,7 @@ FileSystemRequestFileSystemFunction::~FileSystemRequestFileSystemFunction() {
}
ExtensionFunction::ResponseAction FileSystemRequestFileSystemFunction::Run() {
- using extensions::api::file_system::RequestFileSystem::Params;
+ using api::file_system::RequestFileSystem::Params;
const scoped_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
@@ -1303,8 +1296,8 @@ ExtensionFunction::ResponseAction FileSystemRequestFileSystemFunction::Run() {
if (!volume.get())
return RespondNow(Error(kVolumeNotFoundError));
- const GURL site = extensions::util::GetSiteForExtensionId(
- extension_id(), chrome_details_.GetProfile());
+ const GURL site =
+ util::GetSiteForExtensionId(extension_id(), chrome_details_.GetProfile());
scoped_refptr<storage::FileSystemContext> file_system_context =
content::BrowserContext::GetStoragePartitionForSite(
chrome_details_.GetProfile(), site)->GetFileSystemContext();
@@ -1354,8 +1347,8 @@ void FileSystemRequestFileSystemFunction::OnConsentReceived(
return;
}
- const GURL site = extensions::util::GetSiteForExtensionId(
- extension_id(), chrome_details_.GetProfile());
+ const GURL site =
+ util::GetSiteForExtensionId(extension_id(), chrome_details_.GetProfile());
scoped_refptr<storage::FileSystemContext> file_system_context =
content::BrowserContext::GetStoragePartitionForSite(
chrome_details_.GetProfile(), site)->GetFileSystemContext();
@@ -1376,8 +1369,8 @@ void FileSystemRequestFileSystemFunction::OnConsentReceived(
const storage::FileSystemURL original_url =
file_system_context->CreateCrackedFileSystemURL(
- GURL(std::string(extensions::kExtensionScheme) +
- url::kStandardSchemeSeparator + extension_id()),
+ GURL(std::string(kExtensionScheme) + url::kStandardSchemeSeparator +
+ extension_id()),
storage::kFileSystemTypeExternal, virtual_path);
// Set a fixed register name, as the automatic one would leak the mount point
@@ -1445,12 +1438,12 @@ ExtensionFunction::ResponseAction FileSystemGetVolumeListFunction::Run() {
if (!consent_provider.IsGrantable(*extension()))
return RespondNow(Error(kNotSupportedOnNonKioskSessionError));
- using extensions::api::file_system::Volume;
+ using api::file_system::Volume;
std::vector<linked_ptr<Volume>> result_volume_list;
FillVolumeList(chrome_details_.GetProfile(), &result_volume_list);
return RespondNow(
- ArgumentList(extensions::api::file_system::GetVolumeList::Results::Create(
+ ArgumentList(api::file_system::GetVolumeList::Results::Create(
result_volume_list).Pass()));
}
#endif
diff --git a/chrome/browser/extensions/api/file_system/file_system_api.h b/chrome/browser/extensions/api/file_system/file_system_api.h
index 2f8d446..6a2ca2c 100644
--- a/chrome/browser/extensions/api/file_system/file_system_api.h
+++ b/chrome/browser/extensions/api/file_system/file_system_api.h
@@ -64,23 +64,22 @@ class ConsentProvider {
class DelegateInterface {
public:
// Shows a dialog for granting permissions.
- virtual void ShowDialog(const extensions::Extension& extension,
+ virtual void ShowDialog(const Extension& extension,
const base::WeakPtr<file_manager::Volume>& volume,
bool writable,
const ShowDialogCallback& callback) = 0;
// Shows a notification about permissions automatically granted access.
virtual void ShowNotification(
- const extensions::Extension& extension,
+ const Extension& extension,
const base::WeakPtr<file_manager::Volume>& volume,
bool writable) = 0;
// Checks if the extension was launched in auto-launch kiosk mode.
- virtual bool IsAutoLaunched(const extensions::Extension& extension) = 0;
+ virtual bool IsAutoLaunched(const Extension& extension) = 0;
// Checks if the extension is a whitelisted component extension or app.
- virtual bool IsWhitelistedComponent(
- const extensions::Extension& extension) = 0;
+ virtual bool IsWhitelistedComponent(const Extension& extension) = 0;
};
explicit ConsentProvider(DelegateInterface* delegate);
@@ -89,13 +88,13 @@ class ConsentProvider {
// Requests consent for granting |writable| permissions to the |volume|
// volume by the |extension|. Must be called only if the extension is
// grantable, which can be checked with IsGrantable().
- void RequestConsent(const extensions::Extension& extension,
+ void RequestConsent(const Extension& extension,
const base::WeakPtr<file_manager::Volume>& volume,
bool writable,
const ConsentCallback& callback);
// Checks whether the |extension| can be granted access.
- bool IsGrantable(const extensions::Extension& extension);
+ bool IsGrantable(const Extension& extension);
private:
DelegateInterface* const delegate_;
@@ -123,16 +122,16 @@ class ConsentProviderDelegate : public ConsentProvider::DelegateInterface {
static void SetAutoDialogButtonForTest(ui::DialogButton button);
// ConsentProvider::DelegateInterface overrides:
- void ShowDialog(const extensions::Extension& extension,
+ void ShowDialog(const Extension& extension,
const base::WeakPtr<file_manager::Volume>& volume,
bool writable,
const file_system_api::ConsentProvider::ShowDialogCallback&
callback) override;
- void ShowNotification(const extensions::Extension& extension,
+ void ShowNotification(const Extension& extension,
const base::WeakPtr<file_manager::Volume>& volume,
bool writable) override;
- bool IsAutoLaunched(const extensions::Extension& extension) override;
- bool IsWhitelistedComponent(const extensions::Extension& extension) override;
+ bool IsAutoLaunched(const Extension& extension) override;
+ bool IsWhitelistedComponent(const Extension& extension) override;
Profile* const profile_;
content::RenderFrameHost* const host_;
@@ -238,8 +237,7 @@ class FileSystemChooseEntryFunction : public FileSystemEntryFunction {
const base::FilePath& path);
DECLARE_EXTENSION_FUNCTION("fileSystem.chooseEntry", FILESYSTEM_CHOOSEENTRY)
- typedef std::vector<linked_ptr<extensions::api::file_system::AcceptOption> >
- AcceptOptions;
+ typedef std::vector<linked_ptr<api::file_system::AcceptOption>> AcceptOptions;
static void BuildFileTypeInfo(
ui::SelectFileDialog::FileTypeInfo* file_type_info,
diff --git a/chrome/browser/extensions/api/gcd_private/gcd_private_api.cc b/chrome/browser/extensions/api/gcd_private/gcd_private_api.cc
index 5002c76..4a39a56 100644
--- a/chrome/browser/extensions/api/gcd_private/gcd_private_api.cc
+++ b/chrome/browser/extensions/api/gcd_private/gcd_private_api.cc
@@ -57,15 +57,15 @@ scoped_ptr<Event> MakeDeviceStateChangedEvent(
scoped_ptr<base::ListValue> params =
gcd_private::OnDeviceStateChanged::Create(device);
scoped_ptr<Event> event(
- new Event(events::UNKNOWN, gcd_private::OnDeviceStateChanged::kEventName,
- params.Pass()));
+ new Event(events::GCD_PRIVATE_ON_DEVICE_STATE_CHANGED,
+ gcd_private::OnDeviceStateChanged::kEventName, params.Pass()));
return event.Pass();
}
scoped_ptr<Event> MakeDeviceRemovedEvent(const std::string& device) {
scoped_ptr<base::ListValue> params =
gcd_private::OnDeviceRemoved::Create(device);
- scoped_ptr<Event> event(new Event(events::UNKNOWN,
+ scoped_ptr<Event> event(new Event(events::GCD_PRIVATE_ON_DEVICE_REMOVED,
gcd_private::OnDeviceRemoved::kEventName,
params.Pass()));
return event.Pass();
diff --git a/chrome/browser/extensions/api/gcm/gcm_api.cc b/chrome/browser/extensions/api/gcm/gcm_api.cc
index 714f3ee..ba76151 100644
--- a/chrome/browser/extensions/api/gcm/gcm_api.cc
+++ b/chrome/browser/extensions/api/gcm/gcm_api.cc
@@ -215,15 +215,15 @@ void GcmJsEventRouter::OnMessage(const std::string& app_id,
message_arg.collapse_key.reset(new std::string(message.collapse_key));
scoped_ptr<Event> event(
- new Event(events::UNKNOWN, api::gcm::OnMessage::kEventName,
+ new Event(events::GCM_ON_MESSAGE, api::gcm::OnMessage::kEventName,
api::gcm::OnMessage::Create(message_arg).Pass(), profile_));
EventRouter::Get(profile_)->DispatchEventToExtension(app_id, event.Pass());
}
void GcmJsEventRouter::OnMessagesDeleted(const std::string& app_id) {
- scoped_ptr<Event> event(
- new Event(events::UNKNOWN, api::gcm::OnMessagesDeleted::kEventName,
- api::gcm::OnMessagesDeleted::Create().Pass(), profile_));
+ scoped_ptr<Event> event(new Event(
+ events::GCM_ON_MESSAGES_DELETED, api::gcm::OnMessagesDeleted::kEventName,
+ api::gcm::OnMessagesDeleted::Create().Pass(), profile_));
EventRouter::Get(profile_)->DispatchEventToExtension(app_id, event.Pass());
}
@@ -236,7 +236,7 @@ void GcmJsEventRouter::OnSendError(
error.details.additional_properties = send_error_details.additional_data;
scoped_ptr<Event> event(
- new Event(events::UNKNOWN, api::gcm::OnSendError::kEventName,
+ new Event(events::GCM_ON_SEND_ERROR, api::gcm::OnSendError::kEventName,
api::gcm::OnSendError::Create(error).Pass(), profile_));
EventRouter::Get(profile_)->DispatchEventToExtension(app_id, event.Pass());
}
diff --git a/chrome/browser/extensions/api/history/history_api.cc b/chrome/browser/extensions/api/history/history_api.cc
index 47cc8b5..c267fe9 100644
--- a/chrome/browser/extensions/api/history/history_api.cc
+++ b/chrome/browser/extensions/api/history/history_api.cc
@@ -36,7 +36,6 @@ namespace extensions {
using api::history::HistoryItem;
using api::history::VisitItem;
-using extensions::ActivityLog;
typedef std::vector<linked_ptr<api::history::HistoryItem> >
HistoryItemList;
@@ -147,7 +146,8 @@ void HistoryEventRouter::OnURLVisited(history::HistoryService* history_service,
base::Time visit_time) {
scoped_ptr<HistoryItem> history_item = GetHistoryItem(row);
scoped_ptr<base::ListValue> args = OnVisited::Create(*history_item);
- DispatchEvent(profile_, api::history::OnVisited::kEventName, args.Pass());
+ DispatchEvent(profile_, events::HISTORY_ON_VISITED,
+ api::history::OnVisited::kEventName, args.Pass());
}
void HistoryEventRouter::OnURLsDeleted(history::HistoryService* history_service,
@@ -164,19 +164,19 @@ void HistoryEventRouter::OnURLsDeleted(history::HistoryService* history_service,
removed.urls.reset(urls);
scoped_ptr<base::ListValue> args = OnVisitRemoved::Create(removed);
- DispatchEvent(profile_, api::history::OnVisitRemoved::kEventName,
- args.Pass());
+ DispatchEvent(profile_, events::HISTORY_ON_VISIT_REMOVED,
+ api::history::OnVisitRemoved::kEventName, args.Pass());
}
-void HistoryEventRouter::DispatchEvent(
- Profile* profile,
- const std::string& event_name,
- scoped_ptr<base::ListValue> event_args) {
- if (profile && extensions::EventRouter::Get(profile)) {
- scoped_ptr<extensions::Event> event(new extensions::Event(
- extensions::events::UNKNOWN, event_name, event_args.Pass()));
+void HistoryEventRouter::DispatchEvent(Profile* profile,
+ events::HistogramValue histogram_value,
+ const std::string& event_name,
+ scoped_ptr<base::ListValue> event_args) {
+ if (profile && EventRouter::Get(profile)) {
+ scoped_ptr<Event> event(
+ new Event(histogram_value, event_name, event_args.Pass()));
event->restrict_to_browser_context = profile;
- extensions::EventRouter::Get(profile)->BroadcastEvent(event.Pass());
+ EventRouter::Get(profile)->BroadcastEvent(event.Pass());
}
}
diff --git a/chrome/browser/extensions/api/history/history_api.h b/chrome/browser/extensions/api/history/history_api.h
index 0df5980..2335dbd 100644
--- a/chrome/browser/extensions/api/history/history_api.h
+++ b/chrome/browser/extensions/api/history/history_api.h
@@ -49,6 +49,7 @@ class HistoryEventRouter : public history::HistoryServiceObserver {
const std::set<GURL>& favicon_urls) override;
void DispatchEvent(Profile* profile,
+ events::HistogramValue histogram_value,
const std::string& event_name,
scoped_ptr<base::ListValue> event_args);
diff --git a/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc b/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc
index 66162645..4e20c4f 100644
--- a/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc
+++ b/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc
@@ -75,53 +75,67 @@ void HotwordPrivateEventService::OnEnabledChanged(
pref_name == std::string(prefs::kHotwordAlwaysOnSearchEnabled) ||
pref_name == std::string(
hotword_internal::kHotwordTrainingEnabled));
- SignalEvent(OnEnabledChanged::kEventName);
+ SignalEvent(events::HOTWORD_PRIVATE_ON_ENABLED_CHANGED,
+ OnEnabledChanged::kEventName);
}
void HotwordPrivateEventService::OnHotwordSessionRequested() {
- SignalEvent(api::hotword_private::OnHotwordSessionRequested::kEventName);
+ SignalEvent(events::HOTWORD_PRIVATE_ON_HOTWORD_SESSION_REQUESTED,
+ api::hotword_private::OnHotwordSessionRequested::kEventName);
}
void HotwordPrivateEventService::OnHotwordSessionStopped() {
- SignalEvent(api::hotword_private::OnHotwordSessionStopped::kEventName);
+ SignalEvent(events::HOTWORD_PRIVATE_ON_HOTWORD_SESSION_STOPPED,
+ api::hotword_private::OnHotwordSessionStopped::kEventName);
}
void HotwordPrivateEventService::OnFinalizeSpeakerModel() {
- SignalEvent(api::hotword_private::OnFinalizeSpeakerModel::kEventName);
+ SignalEvent(events::HOTWORD_PRIVATE_ON_FINALIZE_SPEAKER_MODEL,
+ api::hotword_private::OnFinalizeSpeakerModel::kEventName);
}
void HotwordPrivateEventService::OnSpeakerModelSaved() {
- SignalEvent(api::hotword_private::OnSpeakerModelSaved::kEventName);
+ SignalEvent(events::HOTWORD_PRIVATE_ON_SPEAKER_MODEL_SAVED,
+ api::hotword_private::OnSpeakerModelSaved::kEventName);
}
void HotwordPrivateEventService::OnHotwordTriggered() {
- SignalEvent(api::hotword_private::OnHotwordTriggered::kEventName);
+ SignalEvent(events::HOTWORD_PRIVATE_ON_HOTWORD_TRIGGERED,
+ api::hotword_private::OnHotwordTriggered::kEventName);
}
void HotwordPrivateEventService::OnDeleteSpeakerModel() {
- SignalEvent(api::hotword_private::OnDeleteSpeakerModel::kEventName);
+ SignalEvent(events::HOTWORD_PRIVATE_ON_DELETE_SPEAKER_MODEL,
+ api::hotword_private::OnDeleteSpeakerModel::kEventName);
}
void HotwordPrivateEventService::OnSpeakerModelExists() {
- SignalEvent(api::hotword_private::OnSpeakerModelExists::kEventName);
+ SignalEvent(events::HOTWORD_PRIVATE_ON_SPEAKER_MODEL_EXISTS,
+ api::hotword_private::OnSpeakerModelExists::kEventName);
}
void HotwordPrivateEventService::OnMicrophoneStateChanged(bool enabled) {
- SignalEvent(api::hotword_private::OnMicrophoneStateChanged::kEventName,
+ SignalEvent(events::HOTWORD_PRIVATE_ON_MICROPHONE_STATE_CHANGED,
+ api::hotword_private::OnMicrophoneStateChanged::kEventName,
api::hotword_private::OnMicrophoneStateChanged::Create(enabled));
}
-void HotwordPrivateEventService::SignalEvent(const std::string& event_name) {
- SignalEvent(event_name, make_scoped_ptr(new base::ListValue()));
+void HotwordPrivateEventService::SignalEvent(
+ events::HistogramValue histogram_value,
+ const std::string& event_name) {
+ SignalEvent(histogram_value, event_name,
+ make_scoped_ptr(new base::ListValue()));
}
-void HotwordPrivateEventService::SignalEvent(const std::string& event_name,
- scoped_ptr<base::ListValue> args) {
+void HotwordPrivateEventService::SignalEvent(
+ events::HistogramValue histogram_value,
+ const std::string& event_name,
+ scoped_ptr<base::ListValue> args) {
EventRouter* router = EventRouter::Get(profile_);
if (!router || !router->HasEventListener(event_name))
return;
- scoped_ptr<Event> event(new Event(events::UNKNOWN, event_name, args.Pass()));
+ scoped_ptr<Event> event(new Event(histogram_value, event_name, args.Pass()));
router->BroadcastEvent(event.Pass());
}
diff --git a/chrome/browser/extensions/api/hotword_private/hotword_private_api.h b/chrome/browser/extensions/api/hotword_private/hotword_private_api.h
index d25b5b7..bf2d0a8 100644
--- a/chrome/browser/extensions/api/hotword_private/hotword_private_api.h
+++ b/chrome/browser/extensions/api/hotword_private/hotword_private_api.h
@@ -10,6 +10,7 @@
#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/common/extensions/api/hotword_private.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
+#include "extensions/browser/extension_event_histogram_value.h"
class Profile;
@@ -49,8 +50,10 @@ class HotwordPrivateEventService : public BrowserContextKeyedAPI {
private:
friend class BrowserContextKeyedAPIFactory<HotwordPrivateEventService>;
- void SignalEvent(const std::string& event_name);
- void SignalEvent(const std::string& event_name,
+ void SignalEvent(events::HistogramValue histogram_value,
+ const std::string& event_name);
+ void SignalEvent(events::HistogramValue histogram_value,
+ const std::string& event_name,
scoped_ptr<base::ListValue> args);
Profile* profile_;
diff --git a/extensions/browser/extension_event_histogram_value.h b/extensions/browser/extension_event_histogram_value.h
index 3bd4efc..c91904c 100644
--- a/extensions/browser/extension_event_histogram_value.h
+++ b/extensions/browser/extension_event_histogram_value.h
@@ -353,6 +353,8 @@ enum HistogramValue {
TTS_ON_EVENT,
LAUNCHER_PAGE_ON_TRANSITION_CHANGED,
LAUNCHER_PAGE_ON_POP_SUBPAGE,
+ DIAL_ON_DEVICE_LIST,
+ DIAL_ON_ERROR,
// Last entry: Add new entries above, then run:
// python tools/metrics/histograms/update_extension_histograms.py
ENUM_BOUNDARY
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index 50da486..d0429d8 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -55039,6 +55039,8 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
<int value="332" label="TTS_ON_EVENT"/>
<int value="333" label="LAUNCHER_PAGE_ON_TRANSITION_CHANGED"/>
<int value="334" label="LAUNCHER_PAGE_ON_POP_SUBPAGE"/>
+ <int value="335" label="DIAL_ON_DEVICE_LIST"/>
+ <int value="336" label="DIAL_ON_ERROR"/>
</enum>
<enum name="ExtensionFileWriteResult" type="int">