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

Unified Diff: chrome/browser/ui/views/extensions/extension_dialog.cc

Issue 363233002: Abstract base 'ExtensionView' to Fix DEPS violation in extension_view_host.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: respond to comments Created 6 years, 6 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: chrome/browser/ui/views/extensions/extension_dialog.cc
diff --git a/chrome/browser/ui/views/extensions/extension_dialog.cc b/chrome/browser/ui/views/extensions/extension_dialog.cc
index ba2c1c774a0a0a86dd1c0aad1192e9bab1941c9c..b68bc1788cb9649074bfac8389b72f77add6bc68 100644
--- a/chrome/browser/ui/views/extensions/extension_dialog.cc
+++ b/chrome/browser/ui/views/extensions/extension_dialog.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/views/constrained_window_views.h"
#include "chrome/browser/ui/views/extensions/extension_dialog_observer.h"
+#include "chrome/browser/ui/views/extensions/extension_view_views.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/render_view_host.h"
@@ -61,8 +62,9 @@ ExtensionDialog* ExtensionDialog::Show(
return NULL;
// Preferred size must be set before views::Widget::CreateWindowWithParent
// is called because CreateWindowWithParent refers the result of CanResize().
- host->view()->SetPreferredSize(gfx::Size(width, height));
- host->view()->set_minimum_size(gfx::Size(min_width, min_height));
+ ExtensionViewViews* view = static_cast<ExtensionViewViews*>(host->view());
+ view->SetPreferredSize(gfx::Size(width, height));
+ view->set_minimum_size(gfx::Size(min_width, min_height));
host->SetAssociatedWebContents(web_contents);
DCHECK(parent_window);
@@ -72,9 +74,9 @@ ExtensionDialog* ExtensionDialog::Show(
// Show a white background while the extension loads. This is prettier than
// flashing a black unfilled window frame.
- host->view()->set_background(
+ view->set_background(
views::Background::CreateSolidBackground(0xFF, 0xFF, 0xFF));
- host->view()->SetVisible(true);
+ view->SetVisible(true);
// Ensure the DOM JavaScript can respond immediately to keyboard shortcuts.
host->host_contents()->Focus();
@@ -103,6 +105,10 @@ void ExtensionDialog::InitWindow(aura::Window* parent,
window->Activate();
}
+ExtensionViewViews* ExtensionDialog::GetExtensionView() const {
Peter Kasting 2014/07/07 22:42:23 Nit: Something this simple should be defined inlin
tapted 2014/07/08 07:11:51 Done - went with the anonymous namespace. This avo
+ return static_cast<ExtensionViewViews*>(host_->view());
+}
+
void ExtensionDialog::ObserverDestroyed() {
observer_ = NULL;
}
@@ -132,11 +138,11 @@ int ExtensionDialog::GetDialogButtons() const {
bool ExtensionDialog::CanResize() const {
// Can resize only if minimum contents size set.
- return host_->view()->GetPreferredSize() != gfx::Size();
+ return GetExtensionView()->GetPreferredSize() != gfx::Size();
}
void ExtensionDialog::SetMinimumContentsSize(int width, int height) {
- host_->view()->SetPreferredSize(gfx::Size(width, height));
+ GetExtensionView()->SetPreferredSize(gfx::Size(width, height));
}
ui::ModalType ExtensionDialog::GetModalType() const {
@@ -162,15 +168,15 @@ void ExtensionDialog::DeleteDelegate() {
}
views::Widget* ExtensionDialog::GetWidget() {
- return host_->view()->GetWidget();
+ return GetExtensionView()->GetWidget();
}
const views::Widget* ExtensionDialog::GetWidget() const {
- return host_->view()->GetWidget();
+ return GetExtensionView()->GetWidget();
}
views::View* ExtensionDialog::GetContentsView() {
- return host_->view();
+ return GetExtensionView();
}
bool ExtensionDialog::UseNewStyleForThisDialog() const {
@@ -187,7 +193,7 @@ void ExtensionDialog::Observe(int type,
case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING:
// Avoid potential overdraw by removing the temporary background after
// the extension finishes loading.
- host_->view()->set_background(NULL);
+ GetExtensionView()->set_background(NULL);
// The render view is created during the LoadURL(), so we should
// set the focus to the view if nobody else takes the focus.
if (content::Details<extensions::ExtensionHost>(host()) == details)

Powered by Google App Engine
This is Rietveld 408576698