Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / ui / views / frame / browser_root_view.h
blob209f3b6efbebcfdb1f32c23bf2909679b2bad7fe
1 // Copyright (c) 2012 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.
5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_ROOT_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_ROOT_VIEW_H_
8 #include "ui/views/widget/root_view.h"
10 class BrowserView;
11 class TabStrip;
13 namespace ui {
14 class OSExchangeData;
17 // RootView implementation used by BrowserFrame. This forwards drop events to
18 // the TabStrip. Visually the tabstrip extends to the top of the frame, but in
19 // actually it doesn't. The tabstrip is only as high as a tab. To enable
20 // dropping above the tabstrip BrowserRootView forwards drop events to the
21 // TabStrip.
22 class BrowserRootView : public views::internal::RootView {
23 public:
24 // Internal class name.
25 static const char kViewClassName[];
27 // You must call set_tabstrip before this class will accept drops.
28 BrowserRootView(BrowserView* browser_view, views::Widget* widget);
30 // Overridden from views::View:
31 bool GetDropFormats(
32 int* formats,
33 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) override;
34 bool AreDropTypesRequired() override;
35 bool CanDrop(const ui::OSExchangeData& data) override;
36 void OnDragEntered(const ui::DropTargetEvent& event) override;
37 int OnDragUpdated(const ui::DropTargetEvent& event) override;
38 void OnDragExited() override;
39 int OnPerformDrop(const ui::DropTargetEvent& event) override;
40 const char* GetClassName() const override;
41 bool OnMouseWheel(const ui::MouseWheelEvent& event) override;
43 private:
44 // ui::EventProcessor:
45 void OnEventProcessingStarted(ui::Event* event) override;
47 // Returns true if the event should be forwarded to the tabstrip.
48 bool ShouldForwardToTabStrip(const ui::DropTargetEvent& event);
50 // Converts the event from the hosts coordinate system to the tabstrips
51 // coordinate system.
52 ui::DropTargetEvent* MapEventToTabStrip(
53 const ui::DropTargetEvent& event,
54 const ui::OSExchangeData& data);
56 inline TabStrip* tabstrip() const;
58 // Returns true if |data| has string contents and the user can "paste and go".
59 // If |url| is non-null and the user can "paste and go", |url| is set to the
60 // desired destination.
61 bool GetPasteAndGoURL(const ui::OSExchangeData& data, GURL* url);
63 // The BrowserView.
64 BrowserView* browser_view_;
66 // If true, drag and drop events are being forwarded to the tab strip.
67 // This is used to determine when to send OnDragEntered and OnDragExited
68 // to the tab strip.
69 bool forwarding_to_tab_strip_;
71 DISALLOW_COPY_AND_ASSIGN(BrowserRootView);
74 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_ROOT_VIEW_H_