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

Side by Side Diff: chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_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: 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/bookmark_manager_private/bookmark_manage r_private_api.h" 5 #include "chrome/browser/extensions/api/bookmark_manager_private/bookmark_manage r_private_api.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/memory/linked_ptr.h" 10 #include "base/memory/linked_ptr.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 179 }
180 180
181 BookmarkManagerPrivateEventRouter::~BookmarkManagerPrivateEventRouter() { 181 BookmarkManagerPrivateEventRouter::~BookmarkManagerPrivateEventRouter() {
182 if (bookmark_model_) 182 if (bookmark_model_)
183 bookmark_model_->RemoveObserver(this); 183 bookmark_model_->RemoveObserver(this);
184 } 184 }
185 185
186 void BookmarkManagerPrivateEventRouter::DispatchEvent( 186 void BookmarkManagerPrivateEventRouter::DispatchEvent(
187 const std::string& event_name, 187 const std::string& event_name,
188 scoped_ptr<base::ListValue> event_args) { 188 scoped_ptr<base::ListValue> event_args) {
189 extensions::EventRouter::Get(browser_context_)->BroadcastEvent( 189 extensions::EventRouter::Get(browser_context_)
190 make_scoped_ptr(new extensions::Event(event_name, event_args.Pass()))); 190 ->BroadcastEvent(make_scoped_ptr(new extensions::Event(
191 extensions::events::UNKNOWN, event_name, event_args.Pass())));
191 } 192 }
192 193
193 void BookmarkManagerPrivateEventRouter::BookmarkModelChanged() {} 194 void BookmarkManagerPrivateEventRouter::BookmarkModelChanged() {}
194 195
195 void BookmarkManagerPrivateEventRouter::BookmarkModelBeingDeleted( 196 void BookmarkManagerPrivateEventRouter::BookmarkModelBeingDeleted(
196 BookmarkModel* model) { 197 BookmarkModel* model) {
197 bookmark_model_ = NULL; 198 bookmark_model_ = NULL;
198 } 199 }
199 200
200 void BookmarkManagerPrivateEventRouter::OnWillChangeBookmarkMetaInfo( 201 void BookmarkManagerPrivateEventRouter::OnWillChangeBookmarkMetaInfo(
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 bookmark_tab_helper->set_bookmark_drag_delegate(NULL); 297 bookmark_tab_helper->set_bookmark_drag_delegate(NULL);
297 } 298 }
298 299
299 void BookmarkManagerPrivateDragEventRouter::DispatchEvent( 300 void BookmarkManagerPrivateDragEventRouter::DispatchEvent(
300 const std::string& event_name, 301 const std::string& event_name,
301 scoped_ptr<base::ListValue> args) { 302 scoped_ptr<base::ListValue> args) {
302 EventRouter* event_router = EventRouter::Get(profile_); 303 EventRouter* event_router = EventRouter::Get(profile_);
303 if (!event_router) 304 if (!event_router)
304 return; 305 return;
305 306
306 scoped_ptr<Event> event(new Event(event_name, args.Pass())); 307 scoped_ptr<Event> event(new Event(events::UNKNOWN, event_name, args.Pass()));
307 event_router->BroadcastEvent(event.Pass()); 308 event_router->BroadcastEvent(event.Pass());
308 } 309 }
309 310
310 void BookmarkManagerPrivateDragEventRouter::OnDragEnter( 311 void BookmarkManagerPrivateDragEventRouter::OnDragEnter(
311 const BookmarkNodeData& data) { 312 const BookmarkNodeData& data) {
312 if (!data.is_valid()) 313 if (!data.is_valid())
313 return; 314 return;
314 DispatchEvent(bookmark_manager_private::OnDragEnter::kEventName, 315 DispatchEvent(bookmark_manager_private::OnDragEnter::kEventName,
315 bookmark_manager_private::OnDragEnter::Create( 316 bookmark_manager_private::OnDragEnter::Create(
316 *CreateApiBookmarkNodeData(profile_, data))); 317 *CreateApiBookmarkNodeData(profile_, data)));
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 851
851 enhanced_bookmarks::EnhancedBookmarkModel* model = 852 enhanced_bookmarks::EnhancedBookmarkModel* model =
852 enhanced_bookmarks::EnhancedBookmarkModelFactory::GetForBrowserContext( 853 enhanced_bookmarks::EnhancedBookmarkModelFactory::GetForBrowserContext(
853 browser_context()); 854 browser_context());
854 model->SetVersionSuffix(params->version); 855 model->SetVersionSuffix(params->version);
855 856
856 return true; 857 return true;
857 } 858 }
858 859
859 } // namespace extensions 860 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698