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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_drag_drop_views.cc

Issue 2216713002: Use BookmarkModelFactory::GetForBrowserContext everywhere (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bookmarks
Patch Set: Replace in .mm files Created 4 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/ui/bookmarks/bookmark_drag_drop.h" 5 #include "chrome/browser/ui/bookmarks/bookmark_drag_drop.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 8 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "components/bookmarks/browser/bookmark_model.h" 10 #include "components/bookmarks/browser/bookmark_model.h"
(...skipping 18 matching lines...) Expand all
29 // Set up our OLE machinery. 29 // Set up our OLE machinery.
30 ui::OSExchangeData data; 30 ui::OSExchangeData data;
31 bookmarks::BookmarkNodeData drag_data(nodes); 31 bookmarks::BookmarkNodeData drag_data(nodes);
32 drag_data.Write(profile->GetPath(), &data); 32 drag_data.Write(profile->GetPath(), &data);
33 33
34 // Allow nested message loop so we get DnD events as we drag this around. 34 // Allow nested message loop so we get DnD events as we drag this around.
35 base::MessageLoop::ScopedNestableTaskAllower nestable_task_allower( 35 base::MessageLoop::ScopedNestableTaskAllower nestable_task_allower(
36 base::MessageLoop::current()); 36 base::MessageLoop::current());
37 37
38 int operation = ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK; 38 int operation = ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK;
39 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile); 39 BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile);
40 if (bookmarks::CanAllBeEditedByUser(model->client(), nodes)) 40 if (bookmarks::CanAllBeEditedByUser(model->client(), nodes))
41 operation |= ui::DragDropTypes::DRAG_MOVE; 41 operation |= ui::DragDropTypes::DRAG_MOVE;
42 42
43 views::Widget* widget = views::Widget::GetWidgetForNativeView(view); 43 views::Widget* widget = views::Widget::GetWidgetForNativeView(view);
44 44
45 if (widget) { 45 if (widget) {
46 widget->RunShellDrag(NULL, data, gfx::Point(), operation, source); 46 widget->RunShellDrag(NULL, data, gfx::Point(), operation, source);
47 } else { 47 } else {
48 // We hit this case when we're using WebContentsViewWin or 48 // We hit this case when we're using WebContentsViewWin or
49 // WebContentsViewAura, instead of WebContentsViewViews. 49 // WebContentsViewAura, instead of WebContentsViewViews.
50 views::RunShellDrag(view, data, gfx::Point(), operation, source); 50 views::RunShellDrag(view, data, gfx::Point(), operation, source);
51 } 51 }
52 } 52 }
53 53
54 } // namespace chrome 54 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698