blob: a5a2e39fe4fc61d3cb79a72911e9cf978acd5e93 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_VIEWS_FRAME_BROWSER_ROOT_VIEW_H
#define CHROME_BROWSER_VIEWS_FRAME_BROWSER_ROOT_VIEW_H
#include "views/widget/root_view.h"
class OSExchangeData;
class TabStrip;
// RootView implementation used by BrowserFrame. This forwards drop events to
// the TabStrip. Visually the tabstrip extends to the top of the frame, but in
// actually it doesn't. The tabstrip is only as high as a tab. To enable
// dropping above the tabstrip BrowserRootView forwards drop events to the
// TabStrip.
class BrowserRootView : public views::RootView {
public:
// You must call set_tabstrip before this class will accept drops.
BrowserRootView(views::Widget* widget);
// Sets the tabstrip associated with this window. This is used to forward
// drag and drop operations to, so no drops will be accepted if there is no
// tabstrip set.
void set_tabstrip(TabStrip* tabstrip) { tabstrip_ = tabstrip; }
virtual bool CanDrop(const OSExchangeData& data);
virtual void OnDragEntered(const views::DropTargetEvent& event);
virtual int OnDragUpdated(const views::DropTargetEvent& event);
virtual void OnDragExited();
virtual int OnPerformDrop(const views::DropTargetEvent& event);
private:
// Returns true if the event should be forwarded to the tabstrip.
bool ShouldForwardToTabStrip(const views::DropTargetEvent& event);
// Converts the event from the hosts coordinate system to the tabstrips
// coordinate system.
views::DropTargetEvent* MapEventToTabStrip(
const views::DropTargetEvent& event);
// The TabStrip.
TabStrip* tabstrip_;
// Is a drop allowed? This is set by CanDrop.
bool can_drop_;
// If true, drag and drop events are being forwarded to the tab strip.
// This is used to determine when to send OnDragEntered and OnDragExited
// to the tab strip.
bool forwarding_to_tab_strip_;
DISALLOW_COPY_AND_ASSIGN(BrowserRootView);
};
#endif // CHROME_BROWSER_VIEWS_FRAME_BROWSER_ROOT_VIEW_H
|