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

Side by Side Diff: chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc

Issue 2509323003: [Extensions] Fix bookmark drag-and-drop bug (Closed)
Patch Set: Created 4 years, 1 month 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 BookmarkTabHelper::FromWebContents(web_contents_); 297 BookmarkTabHelper::FromWebContents(web_contents_);
298 bookmark_tab_helper->set_bookmark_drag_delegate(this); 298 bookmark_tab_helper->set_bookmark_drag_delegate(this);
299 } 299 }
300 300
301 BookmarkManagerPrivateDragEventRouter:: 301 BookmarkManagerPrivateDragEventRouter::
302 ~BookmarkManagerPrivateDragEventRouter() { 302 ~BookmarkManagerPrivateDragEventRouter() {
303 // No need to remove ourselves as the BookmarkTabHelper's delegate, since they 303 // No need to remove ourselves as the BookmarkTabHelper's delegate, since they
304 // are both WebContentsUserData and will be deleted at the same time. 304 // are both WebContentsUserData and will be deleted at the same time.
305 } 305 }
306 306
307 void BookmarkManagerPrivateDragEventRouter::MaybeCreateForWebContents(
308 content::WebContents* web_contents) {
309 content::BrowserContext* context = web_contents->GetBrowserContext();
310 const Extension* extension =
311 ExtensionRegistry::Get(context)
312 ->enabled_extensions()
313 .GetExtensionOrAppByURL(
314 web_contents->GetSiteInstance()->GetSiteURL());
315 if (extension && extension->id() == extension_misc::kBookmarkManagerId)
316 CreateForWebContents(web_contents);
317 }
318
319 void BookmarkManagerPrivateDragEventRouter::DispatchEvent( 307 void BookmarkManagerPrivateDragEventRouter::DispatchEvent(
320 events::HistogramValue histogram_value, 308 events::HistogramValue histogram_value,
321 const std::string& event_name, 309 const std::string& event_name,
322 std::unique_ptr<base::ListValue> args) { 310 std::unique_ptr<base::ListValue> args) {
323 EventRouter* event_router = EventRouter::Get(profile_); 311 EventRouter* event_router = EventRouter::Get(profile_);
324 if (!event_router) 312 if (!event_router)
325 return; 313 return;
326 314
327 std::unique_ptr<Event> event( 315 std::unique_ptr<Event> event(
328 new Event(histogram_value, event_name, std::move(args))); 316 new Event(histogram_value, event_name, std::move(args)));
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 860
873 RedoInfo::Results::Result result; 861 RedoInfo::Results::Result result;
874 result.enabled = undo_manager->redo_count() > 0; 862 result.enabled = undo_manager->redo_count() > 0;
875 result.label = base::UTF16ToUTF8(undo_manager->GetRedoLabel()); 863 result.label = base::UTF16ToUTF8(undo_manager->GetRedoLabel());
876 864
877 results_ = RedoInfo::Results::Create(result); 865 results_ = RedoInfo::Results::Create(result);
878 return true; 866 return true;
879 } 867 }
880 868
881 } // namespace extensions 869 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698