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

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

Issue 1203713002: Limit access to ChromeBookmarkClient to bookmarks code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cleanup_bookmark_client
Patch Set: Rebase 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 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 19 matching lines...) Expand all
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 bool was_nested = base::MessageLoop::current()->IsNested(); 35 bool was_nested = base::MessageLoop::current()->IsNested();
36 base::MessageLoop::current()->SetNestableTasksAllowed(true); 36 base::MessageLoop::current()->SetNestableTasksAllowed(true);
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::GetForProfile(profile);
40 if (bookmarks::CanAllBeEditedByUser(model->client(), nodes)) 40 if (bookmarks::CanAllBeEditedByUser(model, 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 base::MessageLoop::current()->SetNestableTasksAllowed(was_nested); 53 base::MessageLoop::current()->SetNestableTasksAllowed(was_nested);
54 } 54 }
55 55
56 } // namespace chrome 56 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698