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

Side by Side Diff: chrome/browser/tab_contents/web_drag_bookmark_handler_mac.mm

Issue 8430013: Split Mac WebDropTarget into two, content and chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: changes Created 9 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 "chrome/browser/tab_contents/web_drag_bookmark_handler_mac.h"
6
7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/browser_window.h"
9 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
11
12 WebDragBookmarkHandlerMac::WebDragBookmarkHandlerMac()
13 : tab_(NULL) {
14 }
15
16 WebDragBookmarkHandlerMac::~WebDragBookmarkHandlerMac() {}
17
18 void WebDragBookmarkHandlerMac::DragInitialize(TabContents* contents) {
19 DCHECK(tab_ ? (tab_->tab_contents() == contents) : true);
20 if (!tab_)
21 tab_ = TabContentsWrapper::GetCurrentWrapperForContents(contents);
22
23 bookmark_drag_data_.ReadFromDragClipboard();
24 }
25
26 void WebDragBookmarkHandlerMac::OnDragOver() {
27 if (tab_ && tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()) {
28 tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()->OnDragOver(
29 bookmark_drag_data_);
30 }
31 }
32
33 void WebDragBookmarkHandlerMac::OnDragEnter() {
34 if (tab_ && tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()) {
35 tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()->OnDragEnter(
36 bookmark_drag_data_);
37 }
38 }
39
40 void WebDragBookmarkHandlerMac::OnDrop() {
41 // This is non-null if tab_contents_ is showing an ExtensionWebUI with
42 // support for (at the moment experimental) drag and drop extensions.
43 if (tab_) {
44 if (tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()) {
45 tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()->OnDrop(
46 bookmark_drag_data_);
47 }
48
49 // Focus the target browser.
50 Browser* browser = Browser::GetBrowserForController(
51 &tab_->controller(), NULL);
52 if (browser)
53 browser->window()->Show();
54 }
55 }
56
57 void WebDragBookmarkHandlerMac::OnDragLeave() {
58 if (tab_ && tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()) {
59 tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()->OnDragLeave(
60 bookmark_drag_data_);
61 }
62 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/web_drag_bookmark_handler_mac.h ('k') | chrome/browser/ui/cocoa/tab_contents/web_drop_target.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698