| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_VIEWS_FRAME_BROWSER_ROOT_VIEW_H |
| 6 #define CHROME_BROWSER_VIEWS_FRAME_BROWSER_ROOT_VIEW_H |
| 7 |
| 8 #include "chrome/views/root_view.h" |
| 9 |
| 10 class OSExchangeData; |
| 11 class TabStrip; |
| 12 |
| 13 // RootView implementation used by BrowserFrame. This forwards drop events to |
| 14 // the TabStrip. Visually the tabstrip extends to the top of the frame, but in |
| 15 // actually it doesn't. The tabstrip is only as high as a tab. To enable |
| 16 // dropping above the tabstrip BrowserRootView forwards drop events to the |
| 17 // TabStrip. |
| 18 class BrowserRootView : public views::RootView { |
| 19 public: |
| 20 explicit BrowserRootView(views::Widget* widget); |
| 21 |
| 22 virtual bool CanDrop(const OSExchangeData& data); |
| 23 virtual void OnDragEntered(const views::DropTargetEvent& event); |
| 24 virtual int OnDragUpdated(const views::DropTargetEvent& event); |
| 25 virtual void OnDragExited(); |
| 26 virtual int OnPerformDrop(const views::DropTargetEvent& event); |
| 27 |
| 28 private: |
| 29 // Returns true if the event should be forwarded to the tabstrip. |
| 30 bool ShouldForwardToTabStrip(const views::DropTargetEvent& event); |
| 31 |
| 32 // Converts the event from the hosts coordinate system to the tabstrips |
| 33 // coordinate system. |
| 34 views::DropTargetEvent* MapEventToTabStrip( |
| 35 const views::DropTargetEvent& event); |
| 36 |
| 37 // The TabStrip. |
| 38 TabStrip* tabstrip_; |
| 39 |
| 40 // Is a drop allowed? This is set by CanDrop. |
| 41 bool can_drop_; |
| 42 |
| 43 // If true, drag and drop events are being forwarded to the tab strip. |
| 44 // This is used to determine when to send OnDragEntered and OnDragExited |
| 45 // to the tab strip. |
| 46 bool forwarding_to_tab_strip_; |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(BrowserRootView); |
| 49 }; |
| 50 |
| 51 #endif // CHROME_BROWSER_VIEWS_FRAME_BROWSER_ROOT_VIEW_H |
| OLD | NEW |