blob: 89f110a4fa4c75a3dd4dabc9851a8cb3a9b27617 (
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
// Copyright (c) 2012 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_UI_VIEWS_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGATE_VIEWS_H_
#define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGATE_VIEWS_H_
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "components/renderer_context_menu/context_menu_delegate.h"
#include "content/public/browser/web_contents_view_delegate.h"
class LinkDisambiguationPopup;
class RenderViewContextMenuBase;
namespace aura {
class Window;
}
namespace content {
class WebContents;
class WebDragDestDelegate;
class RenderFrameHost;
}
namespace views {
class FocusManager;
class Widget;
}
// A chrome specific class that extends WebContentsViewWin with features like
// focus management, which live in chrome.
class ChromeWebContentsViewDelegateViews
: public content::WebContentsViewDelegate,
public ContextMenuDelegate {
public:
explicit ChromeWebContentsViewDelegateViews(
content::WebContents* web_contents);
~ChromeWebContentsViewDelegateViews() override;
// Overridden from WebContentsViewDelegate:
gfx::NativeWindow GetNativeWindow() override;
content::WebDragDestDelegate* GetDragDestDelegate() override;
void StoreFocus() override;
void RestoreFocus() override;
bool Focus() override;
void TakeFocus(bool reverse) override;
void ShowContextMenu(content::RenderFrameHost* render_frame_host,
const content::ContextMenuParams& params) override;
void SizeChanged(const gfx::Size& size) override;
void ShowDisambiguationPopup(
const gfx::Rect& target_rect,
const SkBitmap& zoomed_bitmap,
const gfx::NativeView content,
const base::Callback<void(ui::GestureEvent*)>& gesture_cb,
const base::Callback<void(ui::MouseEvent*)>& mouse_cb) override;
void HideDisambiguationPopup() override;
// Overridden from ContextMenuDelegate.
scoped_ptr<RenderViewContextMenuBase> BuildMenu(
content::WebContents* web_contents,
const content::ContextMenuParams& params) override;
void ShowMenu(scoped_ptr<RenderViewContextMenuBase> menu) override;
private:
aura::Window* GetActiveNativeView();
views::Widget* GetTopLevelWidget();
views::FocusManager* GetFocusManager();
void SetInitialFocus();
// The id used in the ViewStorage to store the last focused view.
int last_focused_view_storage_id_;
// The context menu is reset every time we show it, but we keep a pointer to
// between uses so that it won't go out of scope before we're done with it.
scoped_ptr<RenderViewContextMenuBase> context_menu_;
// The chrome specific delegate that receives events from WebDragDest.
scoped_ptr<content::WebDragDestDelegate> bookmark_handler_;
content::WebContents* web_contents_;
scoped_ptr<LinkDisambiguationPopup> link_disambiguation_popup_;
DISALLOW_COPY_AND_ASSIGN(ChromeWebContentsViewDelegateViews);
};
#endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGATE_VIEWS_H_
|