| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_VIEWS_FRAME_BROWSER_ROOT_VIEW_H | 5 #ifndef CHROME_BROWSER_VIEWS_FRAME_BROWSER_ROOT_VIEW_H |
| 6 #define CHROME_BROWSER_VIEWS_FRAME_BROWSER_ROOT_VIEW_H | 6 #define CHROME_BROWSER_VIEWS_FRAME_BROWSER_ROOT_VIEW_H |
| 7 | 7 |
| 8 #include "views/widget/root_view.h" | 8 #include "views/widget/root_view.h" |
| 9 | 9 |
| 10 class OSExchangeData; | 10 class OSExchangeData; |
| 11 class TabStrip; | 11 class TabStripWrapper; |
| 12 | 12 |
| 13 // RootView implementation used by BrowserFrame. This forwards drop events to | 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 | 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 | 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 | 16 // dropping above the tabstrip BrowserRootView forwards drop events to the |
| 17 // TabStrip. | 17 // TabStrip. |
| 18 class BrowserRootView : public views::RootView { | 18 class BrowserRootView : public views::RootView { |
| 19 public: | 19 public: |
| 20 // You must call set_tabstrip before this class will accept drops. | 20 // You must call set_tabstrip before this class will accept drops. |
| 21 BrowserRootView(views::Widget* widget); | 21 BrowserRootView(views::Widget* widget); |
| 22 | 22 |
| 23 // Sets the tabstrip associated with this window. This is used to forward | 23 // Sets the tabstrip associated with this window. This is used to forward |
| 24 // drag and drop operations to, so no drops will be accepted if there is no | 24 // drag and drop operations to, so no drops will be accepted if there is no |
| 25 // tabstrip set. | 25 // tabstrip set. |
| 26 void set_tabstrip(TabStrip* tabstrip) { tabstrip_ = tabstrip; } | 26 void set_tabstrip(TabStripWrapper* tabstrip) { tabstrip_ = tabstrip; } |
| 27 | 27 |
| 28 virtual bool CanDrop(const OSExchangeData& data); | 28 virtual bool CanDrop(const OSExchangeData& data); |
| 29 virtual void OnDragEntered(const views::DropTargetEvent& event); | 29 virtual void OnDragEntered(const views::DropTargetEvent& event); |
| 30 virtual int OnDragUpdated(const views::DropTargetEvent& event); | 30 virtual int OnDragUpdated(const views::DropTargetEvent& event); |
| 31 virtual void OnDragExited(); | 31 virtual void OnDragExited(); |
| 32 virtual int OnPerformDrop(const views::DropTargetEvent& event); | 32 virtual int OnPerformDrop(const views::DropTargetEvent& event); |
| 33 | 33 |
| 34 private: | 34 private: |
| 35 // Returns true if the event should be forwarded to the tabstrip. | 35 // Returns true if the event should be forwarded to the tabstrip. |
| 36 bool ShouldForwardToTabStrip(const views::DropTargetEvent& event); | 36 bool ShouldForwardToTabStrip(const views::DropTargetEvent& event); |
| 37 | 37 |
| 38 // Converts the event from the hosts coordinate system to the tabstrips | 38 // Converts the event from the hosts coordinate system to the tabstrips |
| 39 // coordinate system. | 39 // coordinate system. |
| 40 views::DropTargetEvent* MapEventToTabStrip( | 40 views::DropTargetEvent* MapEventToTabStrip( |
| 41 const views::DropTargetEvent& event); | 41 const views::DropTargetEvent& event); |
| 42 | 42 |
| 43 // The TabStrip. | 43 // The TabStrip. |
| 44 TabStrip* tabstrip_; | 44 TabStripWrapper* tabstrip_; |
| 45 | 45 |
| 46 // Is a drop allowed? This is set by CanDrop. | 46 // Is a drop allowed? This is set by CanDrop. |
| 47 bool can_drop_; | 47 bool can_drop_; |
| 48 | 48 |
| 49 // If true, drag and drop events are being forwarded to the tab strip. | 49 // If true, drag and drop events are being forwarded to the tab strip. |
| 50 // This is used to determine when to send OnDragEntered and OnDragExited | 50 // This is used to determine when to send OnDragEntered and OnDragExited |
| 51 // to the tab strip. | 51 // to the tab strip. |
| 52 bool forwarding_to_tab_strip_; | 52 bool forwarding_to_tab_strip_; |
| 53 | 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(BrowserRootView); | 54 DISALLOW_COPY_AND_ASSIGN(BrowserRootView); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 #endif // CHROME_BROWSER_VIEWS_FRAME_BROWSER_ROOT_VIEW_H | 57 #endif // CHROME_BROWSER_VIEWS_FRAME_BROWSER_ROOT_VIEW_H |
| OLD | NEW |