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

Side by Side Diff: ui/views/mus/drag_drop_client_mus.cc

Issue 2611773002: Removes code using mus client lib (Closed)
Patch Set: dont run on linux Created 3 years, 11 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
« no previous file with comments | « ui/views/mus/drag_drop_client_mus.h ('k') | ui/views/mus/drop_target_mus.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/views/mus/drag_drop_client_mus.h"
6
7 #include <map>
8 #include <string>
9 #include <vector>
10
11 #include "base/message_loop/message_loop.h"
12 #include "base/run_loop.h"
13 #include "services/ui/public/cpp/window.h"
14 #include "ui/aura/mus/os_exchange_data_provider_mus.h"
15 #include "ui/aura/window.h"
16
17 namespace views {
18 namespace {
19
20 DragDropClientMus* current_dragging_client = nullptr;
21
22 } // namespace
23
24 DragDropClientMus::DragDropClientMus(ui::Window* ui_window)
25 : ui_window_(ui_window) {}
26
27 DragDropClientMus::~DragDropClientMus() {}
28
29 int DragDropClientMus::StartDragAndDrop(
30 const ui::OSExchangeData& data,
31 aura::Window* root_window,
32 aura::Window* source_window,
33 const gfx::Point& screen_location,
34 int drag_operations,
35 ui::DragDropTypes::DragEventSource source) {
36 std::map<std::string, std::vector<uint8_t>> drag_data =
37 static_cast<const aura::OSExchangeDataProviderMus&>(data.provider())
38 .GetData();
39
40 // TODO(erg): Right now, I'm passing the cursor_location, but maybe I want to
41 // pass OSExchangeData::GetDragImageOffset() instead?
42
43 bool success = false;
44 gfx::Point cursor_location = screen_location;
45 uint32_t action_taken = ui::mojom::kDropEffectNone;
46 current_dragging_client = this;
47 ui_window_->PerformDragDrop(
48 drag_data, drag_operations, cursor_location,
49 *data.provider().GetDragImage().bitmap(),
50 base::Bind(&DragDropClientMus::OnMoveLoopEnd, base::Unretained(this),
51 &success, &action_taken));
52
53 base::MessageLoop* loop = base::MessageLoop::current();
54 base::MessageLoop::ScopedNestableTaskAllower allow_nested(loop);
55 base::RunLoop run_loop;
56
57 runloop_quit_closure_ = run_loop.QuitClosure();
58 run_loop.Run();
59 current_dragging_client = nullptr;
60
61 return action_taken;
62 }
63
64 void DragDropClientMus::DragCancel() {
65 ui_window_->CancelDragDrop();
66 }
67
68 bool DragDropClientMus::IsDragDropInProgress() {
69 return !!current_dragging_client;
70 }
71
72 void DragDropClientMus::OnMoveLoopEnd(bool* out_success,
73 uint32_t* out_action,
74 bool in_success,
75 uint32_t in_action) {
76 *out_success = in_success;
77 *out_action = in_action;
78 runloop_quit_closure_.Run();
79 }
80
81 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/drag_drop_client_mus.h ('k') | ui/views/mus/drop_target_mus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698