summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-12 14:12:39 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-12 14:12:39 +0000
commit20aa47c2e3f8111145e4c7a8309619a1d02c117f (patch)
tree209d594fdfe3f9062e76921d8f4aa2a6b671027a
parent00b7a92cb60c06990b0f2c2ed00188a38f8cdf4c (diff)
downloadchromium_src-20aa47c2e3f8111145e4c7a8309619a1d02c117f.zip
chromium_src-20aa47c2e3f8111145e4c7a8309619a1d02c117f.tar.gz
chromium_src-20aa47c2e3f8111145e4c7a8309619a1d02c117f.tar.bz2
views: Remove extension_view.*
We migrated to extension_view_views.* in a previous revison. So it's safe to remove them now. BUG=125846 TBR=ben@chromium.org Review URL: https://chromiumcodereview.appspot.com/10908186 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156291 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/views/extensions/extension_view.cc179
-rw-r--r--chrome/browser/ui/views/extensions/extension_view.h113
2 files changed, 0 insertions, 292 deletions
diff --git a/chrome/browser/ui/views/extensions/extension_view.cc b/chrome/browser/ui/views/extensions/extension_view.cc
deleted file mode 100644
index 20318c3..0000000
--- a/chrome/browser/ui/views/extensions/extension_view.cc
+++ /dev/null
@@ -1,179 +0,0 @@
-// 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.
-
-#include "chrome/browser/ui/views/extensions/extension_view.h"
-
-#include "chrome/browser/extensions/extension_host.h"
-#include "chrome/browser/ui/views/extensions/extension_popup.h"
-#include "chrome/common/view_type.h"
-#include "content/public/browser/content_browser_client.h"
-#include "content/public/browser/render_view_host.h"
-#include "content/public/browser/render_widget_host_view.h"
-#include "content/public/browser/web_contents.h"
-#include "content/public/browser/web_contents_view.h"
-#include "ui/base/events/event.h"
-#include "ui/views/widget/widget.h"
-
-ExtensionView::ExtensionView(extensions::ExtensionHost* host, Browser* browser)
- : host_(host),
- browser_(browser),
- initialized_(false),
- container_(NULL),
- is_clipped_(false) {
- host_->set_view(this);
-
- // This view needs to be focusable so it can act as the focused view for the
- // focus manager. This is required to have SkipDefaultKeyEventProcessing
- // called so the tab key events are forwarded to the renderer.
- set_focusable(true);
-}
-
-ExtensionView::~ExtensionView() {
- if (parent())
- parent()->RemoveChildView(this);
- CleanUp();
-}
-
-const extensions::Extension* ExtensionView::extension() const {
- return host_->extension();
-}
-
-content::RenderViewHost* ExtensionView::render_view_host() const {
- return host_->render_view_host();
-}
-
-void ExtensionView::DidStopLoading() {
- ShowIfCompletelyLoaded();
-}
-
-void ExtensionView::SetIsClipped(bool is_clipped) {
- if (is_clipped_ != is_clipped) {
- is_clipped_ = is_clipped;
- if (visible())
- ShowIfCompletelyLoaded();
- }
-}
-
-gfx::NativeCursor ExtensionView::GetCursor(const ui::MouseEvent& event) {
- return gfx::kNullCursor;
-}
-
-void ExtensionView::SetVisible(bool is_visible) {
- if (is_visible != visible()) {
- NativeViewHost::SetVisible(is_visible);
-
- // Also tell RenderWidgetHostView the new visibility. Despite its name, it
- // is not part of the View hierarchy and does not know about the change
- // unless we tell it.
- if (render_view_host()->GetView()) {
- if (is_visible)
- render_view_host()->GetView()->Show();
- else
- render_view_host()->GetView()->Hide();
- }
- }
-}
-
-void ExtensionView::CreateWidgetHostView() {
- DCHECK(!initialized_);
- initialized_ = true;
- Attach(host_->host_contents()->GetView()->GetNativeView());
- host_->CreateRenderViewSoon();
- SetVisible(false);
-}
-
-void ExtensionView::ShowIfCompletelyLoaded() {
- if (visible() || is_clipped_)
- return;
-
- // We wait to show the ExtensionView until it has loaded, and the view has
- // actually been created. These can happen in different orders.
- if (host_->did_stop_loading()) {
- SetVisible(true);
- ResizeDueToAutoResize(pending_preferred_size_);
- }
-}
-
-void ExtensionView::CleanUp() {
- if (!initialized_)
- return;
- if (native_view())
- Detach();
- initialized_ = false;
-}
-
-void ExtensionView::SetBackground(const SkBitmap& background) {
- if (render_view_host()->IsRenderViewLive() && render_view_host()->GetView()) {
- render_view_host()->GetView()->SetBackground(background);
- } else {
- pending_background_ = background;
- }
- ShowIfCompletelyLoaded();
-}
-
-void ExtensionView::ResizeDueToAutoResize(const gfx::Size& new_size) {
- // Don't actually do anything with this information until we have been shown.
- // Size changes will not be honored by lower layers while we are hidden.
- if (!visible()) {
- pending_preferred_size_ = new_size;
- return;
- }
-
- gfx::Size preferred_size = GetPreferredSize();
- if (new_size != preferred_size)
- SetPreferredSize(new_size);
-}
-
-void ExtensionView::ViewHierarchyChanged(bool is_add,
- views::View *parent,
- views::View *child) {
- NativeViewHost::ViewHierarchyChanged(is_add, parent, child);
- if (is_add && GetWidget() && !initialized_)
- CreateWidgetHostView();
-}
-
-void ExtensionView::PreferredSizeChanged() {
- View::PreferredSizeChanged();
- if (container_)
- container_->OnExtensionSizeChanged(this);
-}
-
-bool ExtensionView::SkipDefaultKeyEventProcessing(const ui::KeyEvent& e) {
- // Let the tab key event be processed by the renderer (instead of moving the
- // focus to the next focusable view). Also handle Backspace, since otherwise
- // (on Windows at least), pressing Backspace, when focus is on a text field
- // within the ExtensionView, will navigate the page back instead of erasing a
- // character.
- return (e.key_code() == ui::VKEY_TAB || e.key_code() == ui::VKEY_BACK);
-}
-
-void ExtensionView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
- // Propagate the new size to RenderWidgetHostView.
- // We can't send size zero because RenderWidget DCHECKs that.
- if (render_view_host()->GetView() && !bounds().IsEmpty()) {
- render_view_host()->GetView()->SetSize(size());
-
- if (container_)
- container_->OnViewWasResized();
- }
-}
-
-void ExtensionView::RenderViewCreated() {
- if (!pending_background_.empty() && render_view_host()->GetView()) {
- render_view_host()->GetView()->SetBackground(pending_background_);
- pending_background_.reset();
- }
-
- chrome::ViewType host_type = host_->extension_host_type();
- if (host_type == chrome::VIEW_TYPE_EXTENSION_POPUP) {
- gfx::Size min_size(ExtensionPopup::kMinWidth,
- ExtensionPopup::kMinHeight);
- gfx::Size max_size(ExtensionPopup::kMaxWidth,
- ExtensionPopup::kMaxHeight);
- render_view_host()->EnableAutoResize(min_size, max_size);
- }
-
- if (container_)
- container_->OnViewWasResized();
-}
diff --git a/chrome/browser/ui/views/extensions/extension_view.h b/chrome/browser/ui/views/extensions/extension_view.h
deleted file mode 100644
index e8bf50e..0000000
--- a/chrome/browser/ui/views/extensions/extension_view.h
+++ /dev/null
@@ -1,113 +0,0 @@
-// 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_EXTENSIONS_EXTENSION_VIEW_H_
-#define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_VIEW_H_
-
-#include "build/build_config.h"
-
-#include "third_party/skia/include/core/SkBitmap.h"
-#include "ui/views/controls/native/native_view_host.h"
-
-class Browser;
-class ExtensionView;
-
-namespace extensions {
-class Extension;
-class ExtensionHost;
-}
-
-namespace content {
-class RenderViewHost;
-}
-
-// This handles the display portion of an ExtensionHost.
-class ExtensionView : public views::NativeViewHost {
- public:
- ExtensionView(extensions::ExtensionHost* host, Browser* browser);
- virtual ~ExtensionView();
-
- // A class that represents the container that this view is in.
- // (bottom shelf, side bar, etc.)
- class Container {
- public:
- virtual ~Container() {}
- virtual void OnExtensionSizeChanged(ExtensionView* view) {}
- virtual void OnViewWasResized() {}
- };
-
- extensions::ExtensionHost* host() const { return host_; }
- Browser* browser() const { return browser_; }
- const extensions::Extension* extension() const;
- content::RenderViewHost* render_view_host() const;
- void DidStopLoading();
- void SetIsClipped(bool is_clipped);
-
- // Notification from ExtensionHost.
- void ResizeDueToAutoResize(const gfx::Size& new_size);
-
- // Method for the ExtensionHost to notify us when the RenderViewHost has a
- // connection.
- void RenderViewCreated();
-
- // Set a custom background for the view. The background will be tiled.
- void SetBackground(const SkBitmap& background);
-
- // Sets the container for this view.
- void SetContainer(Container* container) { container_ = container; }
-
- // Overridden from views::NativeViewHost:
- virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) OVERRIDE;
- virtual void SetVisible(bool is_visible) OVERRIDE;
- virtual void ViewHierarchyChanged(
- bool is_add, views::View *parent, views::View *child) OVERRIDE;
-
- protected:
- // Overridden from views::View.
- virtual void PreferredSizeChanged() OVERRIDE;
- virtual bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& e) OVERRIDE;
- virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE;
-
- private:
- friend class extensions::ExtensionHost;
-
- // Initializes the RenderWidgetHostView for this object.
- void CreateWidgetHostView();
-
- // We wait to show the ExtensionView until several things have loaded.
- void ShowIfCompletelyLoaded();
-
- // Restore object to initial state. Called on shutdown or after a renderer
- // crash.
- void CleanUp();
-
- // The running extension instance that we're displaying.
- // Note that host_ owns view
- extensions::ExtensionHost* host_;
-
- // The browser window that this view is in.
- Browser* browser_;
-
- // True if we've been initialized.
- bool initialized_;
-
- // The background the view should have once it is initialized. This is set
- // when the view has a custom background, but hasn't been initialized yet.
- SkBitmap pending_background_;
-
- // What we should set the preferred width to once the ExtensionView has
- // loaded.
- gfx::Size pending_preferred_size_;
-
- // The container this view is in (not necessarily its direct superview).
- // Note: the view does not own its container.
- Container* container_;
-
- // Whether this extension view is clipped.
- bool is_clipped_;
-
- DISALLOW_COPY_AND_ASSIGN(ExtensionView);
-};
-
-#endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_VIEW_H_