Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1312)

Unified Diff: content/browser/web_contents/web_contents_view_cast.cc

Issue 223583003: Exclude wifi_data_provider_linux.cc for chromecast build as chromecast uses wpa_supplicant instead … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add chromecast-specific content port implementation. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/web_contents/web_contents_view_cast.cc
diff --git a/content/browser/web_contents/web_contents_view_cast.cc b/content/browser/web_contents/web_contents_view_cast.cc
new file mode 100644
index 0000000000000000000000000000000000000000..17217a4655a935e3279a92eab68ce9a23e632d6c
--- /dev/null
+++ b/content/browser/web_contents/web_contents_view_cast.cc
@@ -0,0 +1,205 @@
+// Copyright 2014 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.
+
+#include "content/browser/web_contents/web_contents_view_cast.h"
+
+#include "base/logging.h"
+#include "content/browser/renderer_host/render_view_host_factory.h"
+#include "content/browser/renderer_host/render_view_host_impl.h"
+#include "content/browser/renderer_host/render_widget_host_view_cast.h"
+#include "content/browser/web_contents/web_contents_impl.h"
+#include "content/public/browser/web_contents.h"
+#include "content/public/browser/web_contents_delegate.h"
+#include "content/public/browser/web_contents_view_delegate.h"
+
+// Chromecast porting notes: this file is derived from the Linux version of the
+// same file.
+
+namespace content {
+
+WebContentsViewPort* CreateWebContentsView(
+ WebContentsImpl* web_contents,
+ WebContentsViewDelegate* delegate,
+ RenderViewHostDelegateView** render_view_host_delegate_view) {
+ WebContentsViewCast* rv = new WebContentsViewCast(web_contents, delegate);
+ *render_view_host_delegate_view = rv;
+ return rv;
+}
+
+WebContentsViewCast::WebContentsViewCast(
+ WebContentsImpl* web_contents,
+ WebContentsViewDelegate* delegate)
+ : web_contents_(web_contents),
+ delegate_(delegate) {
+}
+
+WebContentsViewCast::~WebContentsViewCast() {
+}
+
+gfx::NativeView WebContentsViewCast::GetNativeView() const {
+ NOTIMPLEMENTED();
+ return NULL;
+}
+
+gfx::NativeView WebContentsViewCast::GetContentNativeView() const {
+ RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView();
+ if (!rwhv)
+ return NULL;
+ return rwhv->GetNativeView();
+}
+
+gfx::NativeWindow WebContentsViewCast::GetTopLevelNativeWindow() const {
+ NOTIMPLEMENTED();
+ return NULL;
+}
+
+void WebContentsViewCast::GetContainerBounds(gfx::Rect* out) const {
+ // If we ever add a border (other widgets on the screen), this
+ // code will have to be revisited to account for other widgets on the screen.
+ out->SetRect(0, 0, requested_size_.width(), requested_size_.height());
+}
+
+void WebContentsViewCast::OnTabCrashed(base::TerminationStatus status,
+ int error_code) {
+ NOTIMPLEMENTED();
+}
+
+void WebContentsViewCast::Focus() {
+ NOTIMPLEMENTED();
+}
+
+void WebContentsViewCast::SetInitialFocus() {
+ if (web_contents_->FocusLocationBarByDefault())
+ web_contents_->SetFocusToLocationBar(false);
+ else
+ Focus();
+}
+
+void WebContentsViewCast::StoreFocus() {
+ NOTIMPLEMENTED();
+}
+
+void WebContentsViewCast::RestoreFocus() {
+ NOTIMPLEMENTED();
+}
+
+DropData* WebContentsViewCast::GetDropData() const {
+ NOTIMPLEMENTED();
+ return NULL;
+}
+
+gfx::Rect WebContentsViewCast::GetViewBounds() const {
+ // As in GetContainerBounds, the code will have to be revisited if other
+ // widgets are visible on the screen.
+ gfx::Rect out;
+ out.SetRect(0, 0, requested_size_.width(), requested_size_.height());
+ return out;
+}
+
+void WebContentsViewCast::CreateView(const gfx::Size& initial_size,
+ gfx::NativeView context) {
+ requested_size_ = initial_size;
+}
+
+RenderWidgetHostView* WebContentsViewCast::CreateViewForWidget(
+ RenderWidgetHost* render_widget_host) {
+ if (render_widget_host->GetView()) {
+ // During testing, the view will already be set up in most cases to the
+ // test view, so we don't want to clobber it with a real one. To verify that
+ // this actually is happening (and somebody isn't accidentally creating the
+ // view twice), we check for the RVH Factory, which will be set when we're
+ // making special ones (which go along with the special views).
+ DCHECK(RenderViewHostFactory::has_factory());
+ return render_widget_host->GetView();
+ }
+
+ RenderWidgetHostView* view =
+ RenderWidgetHostView::CreateViewForWidget(render_widget_host);
+ view->InitAsChild(NULL);
+
+ // TODO(lcwu): Need to look at whether these calls are in the correct place.
+ // They are currently here to make sure we have the correct view size for
+ // compositing path.
+ view->SetSize(requested_size_);
+ view->Show();
+ return view;
+}
+
+RenderWidgetHostView* WebContentsViewCast::CreateViewForPopupWidget(
+ RenderWidgetHost* render_widget_host) {
+ return RenderWidgetHostViewPort::CreateViewForWidget(render_widget_host);
+}
+
+void WebContentsViewCast::SetPageTitle(const base::string16& title) {
+ NOTIMPLEMENTED();
+}
+
+void WebContentsViewCast::SizeContents(const gfx::Size& size) {
+ requested_size_ = size;
+ // Pass the sizing information on to the RWHV which will pass the sizing
+ // information on to the renderer.
+ RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView();
+ if (rwhv)
+ rwhv->SetSize(size);
+}
+
+void WebContentsViewCast::RenderViewCreated(RenderViewHost* host) {
+ NOTIMPLEMENTED();
+}
+
+void WebContentsViewCast::RenderViewSwappedIn(RenderViewHost* host) {
+ NOTIMPLEMENTED();
+}
+
+void WebContentsViewCast::SetOverscrollControllerEnabled(bool enabled) {
+ NOTIMPLEMENTED();
+}
+
+WebContents* WebContentsViewCast::web_contents() {
+ return web_contents_;
+}
+
+void WebContentsViewCast::ShowContextMenu(
+ RenderFrameHost* render_frame_host,
+ const ContextMenuParams& params) {
+ if (delegate_.get())
+ delegate_->ShowContextMenu(render_frame_host, params);
+ else
+ DLOG(ERROR) << "Cannot show context menus without a delegate.";
+}
+
+void WebContentsViewCast::ShowPopupMenu(
+ const gfx::Rect& bounds,
+ int item_height,
+ double item_font_size,
+ int selected_item,
+ const std::vector<MenuItem>& items,
+ bool right_aligned,
+ bool allow_multiple_selection) {
+ // External popup menus are only used on Mac and Android.
+ NOTIMPLEMENTED();
+}
+
+void WebContentsViewCast::StartDragging(
+ const DropData& drop_data,
+ blink::WebDragOperationsMask allowed_ops,
+ const gfx::ImageSkia& image,
+ const gfx::Vector2d& image_offset,
+ const DragEventSourceInfo& event_info) {
+ NOTIMPLEMENTED();
+}
+
+void WebContentsViewCast::UpdateDragCursor(blink::WebDragOperation op) {
+ NOTIMPLEMENTED();
+}
+
+void WebContentsViewCast::GotFocus() {
+ NOTIMPLEMENTED();
+}
+
+void WebContentsViewCast::TakeFocus(bool reverse) {
+ NOTIMPLEMENTED();
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698