~oxide-developers/oxide/1.2

« back to all changes in this revision

Viewing changes to oxide/browser/oxide_web_contents_view.cc

  • Committer: Chris Coulson
  • Date: 2013-07-23 11:40:24 UTC
  • Revision ID: chris.coulson@canonical.com-20130723114024-p7z00cs9p0s5te6e
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// vim:expandtab:shiftwidth=2:tabstop=2:
 
2
// Copyright (C) 2013 Canonical Ltd.
 
3
 
 
4
// This library is free software; you can redistribute it and/or
 
5
// modify it under the terms of the GNU Lesser General Public
 
6
// License as published by the Free Software Foundation; either
 
7
// version 2.1 of the License, or (at your option) any later version.
 
8
 
 
9
// This library is distributed in the hope that it will be useful,
 
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
// Lesser General Public License for more details.
 
13
 
 
14
// You should have received a copy of the GNU Lesser General Public
 
15
// License along with this library; if not, write to the Free Software
 
16
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
17
 
 
18
#include "oxide_web_contents_view.h"
 
19
 
 
20
#include "content/public/browser/render_widget_host_view.h"
 
21
#include "content/public/browser/web_contents.h"
 
22
 
 
23
#include "oxide_web_contents_view_delegate.h"
 
24
 
 
25
namespace oxide {
 
26
 
 
27
WebContentsView::WebContentsView(content::WebContents* web_contents) :
 
28
    web_contents_(web_contents),
 
29
    delegate_(NULL) {}
 
30
 
 
31
WebContentsView::~WebContentsView() {}
 
32
 
 
33
void WebContentsView::CreateView(const gfx::Size& initial_size,
 
34
                                 gfx::NativeView context) {
 
35
  requested_size_ = initial_size;
 
36
}
 
37
 
 
38
content::RenderWidgetHostView* WebContentsView::CreateViewForWidget(
 
39
    content::RenderWidgetHost* render_widget_host) {
 
40
  if (delegate_) {
 
41
    return delegate_->CreateViewForWidget(render_widget_host);
 
42
  }
 
43
 
 
44
  return NULL;
 
45
}
 
46
 
 
47
content::RenderWidgetHostView* WebContentsView::CreateViewForPopupWidget(
 
48
    content::RenderWidgetHost* render_widget_host) {
 
49
  return NULL;
 
50
}
 
51
 
 
52
void WebContentsView::SetPageTitle(const string16& title) {}
 
53
 
 
54
void WebContentsView::RenderViewCreated(content::RenderViewHost* host) {}
 
55
 
 
56
void WebContentsView::RenderViewSwappedIn(content::RenderViewHost* host) {}
 
57
 
 
58
void WebContentsView::SetOverscrollControllerEnabled(bool enabled) {}
 
59
 
 
60
gfx::NativeView WebContentsView::GetNativeView() const {
 
61
  return NULL;
 
62
}
 
63
 
 
64
gfx::NativeView WebContentsView::GetContentNativeView() const {
 
65
  return NULL;
 
66
}
 
67
 
 
68
gfx::NativeWindow WebContentsView::GetTopLevelNativeWindow() const {
 
69
  return NULL;
 
70
}
 
71
 
 
72
void WebContentsView::GetContainerBounds(gfx::Rect* out) const {
 
73
  if (delegate_) {
 
74
    *out = delegate_->GetContainerBounds();
 
75
  } else {
 
76
    *out = gfx::Rect();
 
77
  }
 
78
}
 
79
 
 
80
void WebContentsView::OnTabCrashed(base::TerminationStatus status,
 
81
                                   int error_code) {}
 
82
 
 
83
void WebContentsView::SizeContents(const gfx::Size& size) {
 
84
  requested_size_ = size;
 
85
 
 
86
  content::RenderWidgetHostView* rwhv =
 
87
      web_contents_->GetRenderWidgetHostView();
 
88
  if (rwhv) {
 
89
    rwhv->SetSize(size);
 
90
  }
 
91
}
 
92
 
 
93
void WebContentsView::Focus() {
 
94
  content::RenderWidgetHostView* rwhv =
 
95
      web_contents_->GetRenderWidgetHostView();
 
96
  if (rwhv) {
 
97
    rwhv->Focus();
 
98
  }
 
99
}
 
100
 
 
101
void WebContentsView::SetInitialFocus() {}
 
102
 
 
103
void WebContentsView::StoreFocus() {}
 
104
 
 
105
void WebContentsView::RestoreFocus() {}
 
106
 
 
107
content::DropData* WebContentsView::GetDropData() const {
 
108
  return NULL;
 
109
}
 
110
 
 
111
gfx::Rect WebContentsView::GetViewBounds() const {
 
112
  content::RenderWidgetHostView* rwhv =
 
113
      web_contents_->GetRenderWidgetHostView();
 
114
  if (rwhv) {
 
115
    return rwhv->GetViewBounds();
 
116
  }
 
117
 
 
118
  return gfx::Rect();
 
119
}
 
120
 
 
121
void WebContentsView::ShowPopupMenu(const gfx::Rect& bounds,
 
122
                                    int item_height,
 
123
                                    double item_font_size,
 
124
                                    int selected_item,
 
125
                                    const std::vector<WebMenuItem>& items,
 
126
                                    bool right_aligned,
 
127
                                    bool allow_multiple_selection) {}
 
128
 
 
129
void WebContentsView::SetDelegate(WebContentsViewDelegate* delegate) {
 
130
  delegate_ = delegate;
 
131
}
 
132
 
 
133
} // namespace oxide