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

Unified Diff: apps/shell/web_view_window.cc

Issue 151893002: Reorganize apps/shell into app, browser and common directories (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase (subdirs) Created 6 years, 11 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
« no previous file with comments | « apps/shell/web_view_window.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apps/shell/web_view_window.cc
diff --git a/apps/shell/web_view_window.cc b/apps/shell/web_view_window.cc
deleted file mode 100644
index 91e804968a52ff594812cec0c27a4869ca36485a..0000000000000000000000000000000000000000
--- a/apps/shell/web_view_window.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2013 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 "apps/shell/web_view_window.h"
-
-#include "content/public/browser/web_contents.h"
-#include "content/public/browser/web_contents_view.h"
-#include "ui/aura/window.h"
-#include "ui/views/controls/webview/webview.h"
-#include "ui/views/layout/fill_layout.h"
-#include "ui/views/widget/widget.h"
-#include "ui/views/widget/widget_delegate.h"
-
-namespace {
-
-// A simple window containing a single web view.
-class WebViewWindowContents : public views::WidgetDelegateView {
- public:
- explicit WebViewWindowContents(content::BrowserContext* browser_context)
- : browser_context_(browser_context) {}
- virtual ~WebViewWindowContents() {}
-
- // views::WidgetDelegateView overrides:
- virtual views::View* GetContentsView() OVERRIDE;
- virtual void WindowClosing() OVERRIDE;
-
- // views::View overrides:
- virtual void ViewHierarchyChanged(
- const ViewHierarchyChangedDetails& details) OVERRIDE;
-
- private:
- // Initialize this view's children.
- void InitChildViews();
-
- content::BrowserContext* browser_context_;
-
- DISALLOW_COPY_AND_ASSIGN(WebViewWindowContents);
-};
-
-views::View* WebViewWindowContents::GetContentsView() {
- return this;
-}
-
-void WebViewWindowContents::WindowClosing() {
- // Close the app when the window is closed.
- base::MessageLoopForUI::current()->Quit();
-}
-
-void WebViewWindowContents::ViewHierarchyChanged(
- const ViewHierarchyChangedDetails& details) {
- // Initialize child views when this view is attached.
- if (details.is_add && details.child == this)
- InitChildViews();
-}
-
-void WebViewWindowContents::InitChildViews() {
- // Create a WebView that fills the window.
- SetLayoutManager(new views::FillLayout);
- views::WebView* web_view = new views::WebView(browser_context_);
- AddChildView(web_view);
-
- web_view->LoadInitialURL(GURL("http://www.google.com/"));
- web_view->web_contents()->GetView()->Focus();
-}
-
-} // namespace
-
-namespace apps {
-
-void ShowWebViewWindow(content::BrowserContext* browser_context,
- aura::Window* window_context) {
- views::Widget* widget = new views::Widget;
- views::Widget::InitParams params;
- params.delegate = new WebViewWindowContents(browser_context);
- params.context = window_context;
- params.bounds = window_context->bounds();
- params.top_level = true;
- widget->Init(params);
- widget->Show();
-}
-
-} // namespace apps
« no previous file with comments | « apps/shell/web_view_window.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698