Commit 8fdd9a89 authored by jeremya@chromium.org's avatar jeremya@chromium.org

Refactor ShellWindow to separate platform-specific code.



Review URL: https://chromiumcodereview.appspot.com/10825240

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152063 0039d316-1c4b-4281-b951-d872f2087c98
parent 999801a5
......@@ -104,7 +104,7 @@ bool AppWindowCreateFunction::RunImpl() {
}
ShellWindow* shell_window =
ShellWindow::Create(profile(), GetExtension(), url, create_params);
shell_window->Show();
shell_window->GetBaseWindow()->Show();
content::WebContents* created_contents = shell_window->web_contents();
int view_id = created_contents->GetRenderViewHost()->GetRoutingID();
......@@ -114,22 +114,22 @@ bool AppWindowCreateFunction::RunImpl() {
}
bool AppWindowFocusFunction::RunWithWindow(ShellWindow* window) {
window->Activate();
window->GetBaseWindow()->Activate();
return true;
}
bool AppWindowMaximizeFunction::RunWithWindow(ShellWindow* window) {
window->Maximize();
window->GetBaseWindow()->Maximize();
return true;
}
bool AppWindowMinimizeFunction::RunWithWindow(ShellWindow* window) {
window->Minimize();
window->GetBaseWindow()->Minimize();
return true;
}
bool AppWindowRestoreFunction::RunWithWindow(ShellWindow* window) {
window->Restore();
window->GetBaseWindow()->Restore();
return true;
}
......
......@@ -116,7 +116,7 @@ void PlatformAppBrowserTest::CloseShellWindow(ShellWindow* window) {
content::WindowedNotificationObserver destroyed_observer(
content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
content::NotificationService::AllSources());
window->Close();
window->GetBaseWindow()->Close();
destroyed_observer.Wait();
}
......
......@@ -64,7 +64,7 @@ ShellWindow* ShellWindowRegistry::GetShellWindowForNativeWindow(
gfx::NativeWindow window) const {
for (ShellWindowSet::const_iterator i = shell_windows_.begin();
i != shell_windows_.end(); ++i) {
if ((*i)->GetNativeWindow() == window)
if ((*i)->GetBaseWindow()->GetNativeWindow() == window)
return *i;
}
......
......@@ -653,7 +653,7 @@ void ChromeLauncherController::Observe(
}
void ChromeLauncherController::OnShellWindowAdded(ShellWindow* shell_window) {
aura::Window* window = shell_window->GetNativeWindow();
aura::Window* window = shell_window->GetBaseWindow()->GetNativeWindow();
ash::LauncherItemStatus status = ash::wm::IsActiveWindow(window) ?
ash::STATUS_ACTIVE : ash::STATUS_RUNNING;
window->AddObserver(this);
......@@ -713,7 +713,8 @@ void ChromeLauncherController::OnWindowRemovingFromRootWindow(
// We can't count on getting called before or after the ShellWindowRegistry.
if (remaining_windows.size() > 1 ||
(remaining_windows.size() == 1 &&
(*remaining_windows.begin())->GetNativeWindow() != window)) {
(*remaining_windows.begin())->GetBaseWindow()->GetNativeWindow() !=
window)) {
return;
}
......
......@@ -10,10 +10,11 @@
#include "base/memory/scoped_nsobject.h"
#include "chrome/browser/ui/cocoa/constrained_window_mac.h"
#include "chrome/browser/ui/extensions/native_shell_window.h"
#include "chrome/browser/ui/extensions/shell_window.h"
#include "chrome/common/extensions/draggable_region.h"
#include "ui/gfx/rect.h"
#import "third_party/GTM/AppKit/GTMWindowSheetController.h"
#include "ui/gfx/rect.h"
class Profile;
class ShellWindowCocoa;
......@@ -35,12 +36,10 @@ class ShellWindowCocoa;
@end
// Cocoa bridge to ShellWindow.
class ShellWindowCocoa : public ShellWindow {
class ShellWindowCocoa : public NativeShellWindow {
public:
ShellWindowCocoa(Profile* profile,
const extensions::Extension* extension,
const GURL& url,
const CreateParams& params);
ShellWindowCocoa(ShellWindow* shell_window,
const ShellWindow::CreateParams& params);
// BaseWindow implementation.
virtual bool IsActive() const OVERRIDE;
......@@ -72,23 +71,31 @@ class ShellWindowCocoa : public ShellWindow {
void WindowDidResignKey();
protected:
// ShellWindow implementation.
// NativeShellWindow implementation.
virtual void SetFullscreen(bool fullscreen) OVERRIDE;
virtual bool IsFullscreenOrPending() const OVERRIDE;
virtual void UpdateWindowTitle() OVERRIDE;
virtual void UpdateDraggableRegions(
const std::vector<extensions::DraggableRegion>& regions) OVERRIDE;
private:
virtual ~ShellWindowCocoa();
// ShellWindow implementation.
virtual void UpdateDraggableRegions(
const std::vector<extensions::DraggableRegion>& regions) OVERRIDE;
NSWindow* window() const;
content::WebContents* web_contents() const {
return shell_window_->web_contents();
}
const extensions::Extension* extension() const {
return shell_window_->extension();
}
void InstallView();
void UninstallView();
void InstallDraggableRegionViews();
ShellWindow* shell_window_; // weak - ShellWindow owns NativeShellWindow.
bool has_frame_;
bool is_fullscreen_;
......
......@@ -121,11 +121,9 @@
- (void)setMouseDownCanMoveWindow:(BOOL)can_move;
@end
ShellWindowCocoa::ShellWindowCocoa(Profile* profile,
const extensions::Extension* extension,
const GURL& url,
ShellWindowCocoa::ShellWindowCocoa(ShellWindow* shell_window,
const ShellWindow::CreateParams& params)
: ShellWindow(profile, extension, url),
: shell_window_(shell_window),
has_frame_(params.frame == ShellWindow::CreateParams::FRAME_CHROME),
attention_request_id_(0) {
// Flip coordinates based on the primary screen.
......@@ -141,7 +139,7 @@ ShellWindowCocoa::ShellWindowCocoa(Profile* profile,
styleMask:style_mask
backing:NSBackingStoreBuffered
defer:NO]);
[window setTitle:base::SysUTF8ToNSString(extension->name())];
[window setTitle:base::SysUTF8ToNSString(extension()->name())];
gfx::Size min_size = params.minimum_size;
if (min_size.width() || min_size.height()) {
[window setContentMinSize:NSMakeSize(min_size.width(), min_size.height())];
......@@ -353,6 +351,10 @@ void ShellWindowCocoa::SetBounds(const gfx::Rect& bounds) {
[window() setFrame:cocoa_bounds display:YES];
}
void ShellWindowCocoa::UpdateWindowTitle() {
// TODO(jeremya): implement.
}
void ShellWindowCocoa::UpdateDraggableRegions(
const std::vector<extensions::DraggableRegion>& regions) {
// Draggable region is not supported for non-frameless window.
......@@ -412,7 +414,7 @@ bool ShellWindowCocoa::IsAlwaysOnTop() const {
void ShellWindowCocoa::WindowWillClose() {
[window_controller_ setShellWindow:NULL];
OnNativeClose();
shell_window_->OnNativeClose();
}
void ShellWindowCocoa::WindowDidBecomeKey() {
......@@ -444,9 +446,7 @@ NSWindow* ShellWindowCocoa::window() const {
}
// static
ShellWindow* ShellWindow::CreateImpl(Profile* profile,
const extensions::Extension* extension,
const GURL& url,
const ShellWindow::CreateParams& params) {
return new ShellWindowCocoa(profile, extension, url, params);
NativeShellWindow* NativeShellWindow::Create(
ShellWindow* shell_window, const ShellWindow::CreateParams& params) {
return new ShellWindowCocoa(shell_window, params);
}
// 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_EXTENSIONS_NATIVE_SHELL_WINDOW_H_
#define CHROME_BROWSER_UI_EXTENSIONS_NATIVE_SHELL_WINDOW_H_
#include "chrome/browser/ui/extensions/shell_window.h"
#include "chrome/browser/ui/base_window.h"
// This is an interface to a native implementation of a shell window, used for
// new-style packaged apps. Shell windows contain a web contents, but no tabs
// or URL bar.
class NativeShellWindow : public BaseWindow {
public:
// Used by ShellWindow to instantiate the platform-specific ShellWindow code.
static NativeShellWindow* Create(ShellWindow* window,
const ShellWindow::CreateParams& params);
// Called when the title of the window changes.
virtual void UpdateWindowTitle() = 0;
// Called when the draggable regions are changed.
virtual void UpdateDraggableRegions(
const std::vector<extensions::DraggableRegion>& regions) {}
virtual void SetFullscreen(bool fullscreen) = 0;
virtual bool IsFullscreenOrPending() const = 0;
virtual ~NativeShellWindow() {}
};
#endif // CHROME_BROWSER_UI_EXTENSIONS_NATIVE_SHELL_WINDOW_H_
......@@ -17,6 +17,7 @@
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/extensions/native_shell_window.h"
#include "chrome/browser/ui/intents/web_intent_picker_controller.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/browser/view_type_utils.h"
......@@ -70,26 +71,25 @@ ShellWindow* ShellWindow::Create(Profile* profile,
const GURL& url,
const ShellWindow::CreateParams& params) {
// This object will delete itself when the window is closed.
ShellWindow* window =
ShellWindow::CreateImpl(profile, extension, url, params);
ShellWindow* window = new ShellWindow(profile, extension);
window->Init(url, params);
extensions::ShellWindowRegistry::Get(profile)->AddShellWindow(window);
return window;
}
ShellWindow::ShellWindow(Profile* profile,
const extensions::Extension* extension,
const GURL& url)
const extensions::Extension* extension)
: profile_(profile),
extension_(extension),
web_contents_(NULL),
ALLOW_THIS_IN_INITIALIZER_LIST(
extension_function_dispatcher_(profile, this)) {
// TODO(jeremya) this should all be done in an Init() method, not in the
// constructor. During this code, WebContents will be calling
// WebContentsDelegate methods, but at this point the vftables for the
// subclass are not yet in place, since it's still halfway through its
// constructor. As a result, overridden virtual methods won't be called.
}
void ShellWindow::Init(const GURL& url,
const ShellWindow::CreateParams& params) {
web_contents_ = WebContents::Create(
profile, SiteInstance::CreateForURL(profile, url), MSG_ROUTING_NONE,
profile(), SiteInstance::CreateForURL(profile(), url), MSG_ROUTING_NONE,
NULL);
contents_.reset(new TabContents(web_contents_));
content::WebContentsObserver::Observe(web_contents_);
......@@ -99,6 +99,8 @@ ShellWindow::ShellWindow(Profile* profile,
browser_handles_all_top_level_requests = true;
web_contents_->GetRenderViewHost()->SyncRendererPrefs();
native_window_.reset(NativeShellWindow::Create(this, params));
// Block the created RVH from loading anything until the background page
// has had a chance to do any initialization it wants.
SuspendRenderViewHost(web_contents_->GetRenderViewHost());
......@@ -144,10 +146,6 @@ ShellWindow::~ShellWindow() {
browser::EndKeepAlive();
}
bool ShellWindow::IsFullscreenOrPending() const {
return false;
}
void ShellWindow::RequestMediaAccessPermission(
content::WebContents* web_contents,
const content::MediaStreamRequest* request,
......@@ -239,6 +237,10 @@ void ShellWindow::OnNativeClose() {
delete this;
}
BaseWindow* ShellWindow::GetBaseWindow() {
return native_window_.get();
}
string16 ShellWindow::GetTitle() const {
// WebContents::GetTitle() will return the page's URL if there's no <title>
// specified. However, we'd prefer to show the name of the extension in that
......@@ -260,8 +262,14 @@ bool ShellWindow::OnMessageReceived(const IPC::Message& message) {
return handled;
}
void ShellWindow::UpdateDraggableRegions(
const std::vector<extensions::DraggableRegion>& regions) {
native_window_->UpdateDraggableRegions(regions);
}
void ShellWindow::CloseContents(WebContents* contents) {
Close();
DCHECK(contents == web_contents_);
native_window_->Close();
}
bool ShellWindow::ShouldSuppressDialogs() {
......@@ -293,26 +301,26 @@ bool ShellWindow::IsPopupOrPanel(const WebContents* source) const {
void ShellWindow::MoveContents(WebContents* source, const gfx::Rect& pos) {
DCHECK(source == web_contents_);
SetBounds(pos);
native_window_->SetBounds(pos);
}
void ShellWindow::NavigationStateChanged(
const content::WebContents* source, unsigned changed_flags) {
DCHECK(source == web_contents_);
if (changed_flags & content::INVALIDATE_TYPE_TITLE)
UpdateWindowTitle();
native_window_->UpdateWindowTitle();
}
void ShellWindow::ToggleFullscreenModeForTab(content::WebContents* source,
bool enter_fullscreen) {
DCHECK(source == web_contents_);
SetFullscreen(enter_fullscreen);
native_window_->SetFullscreen(enter_fullscreen);
}
bool ShellWindow::IsFullscreenForTabOrPending(
const content::WebContents* source) const {
DCHECK(source == web_contents_);
return IsFullscreenOrPending();
return native_window_->IsFullscreenOrPending();
}
void ShellWindow::Observe(int type,
......@@ -334,11 +342,11 @@ void ShellWindow::Observe(int type,
content::Details<extensions::UnloadedExtensionInfo>(
details)->extension;
if (extension_ == unloaded_extension)
Close();
native_window_->Close();
break;
}
case content::NOTIFICATION_APP_TERMINATING:
Close();
native_window_->Close();
break;
default:
NOTREACHED() << "Received unexpected notification";
......
......@@ -19,6 +19,7 @@
class GURL;
class Profile;
class TabContents;
class NativeShellWindow;
namespace content {
class WebContents;
......@@ -37,8 +38,7 @@ struct DraggableRegion;
class ShellWindow : public content::NotificationObserver,
public content::WebContentsDelegate,
public content::WebContentsObserver,
public ExtensionFunctionDispatcher::Delegate,
public BaseWindow {
public ExtensionFunctionDispatcher::Delegate {
public:
struct CreateParams {
enum Frame {
......@@ -65,40 +65,33 @@ class ShellWindow : public content::NotificationObserver,
const extensions::Extension* extension() const { return extension_; }
const TabContents* tab_contents() const { return contents_.get(); }
content::WebContents* web_contents() const { return web_contents_; }
Profile* profile() const { return profile_; }
protected:
ShellWindow(Profile* profile,
const extensions::Extension* extension,
const GURL& url);
virtual ~ShellWindow();
BaseWindow* GetBaseWindow();
gfx::NativeWindow GetNativeWindow() {
return GetBaseWindow()->GetNativeWindow();
}
// Called when the title of the window changes.
virtual void UpdateWindowTitle() {}
// Sub-classes should call this to determine what the window's title is on
// startup and from within UpdateWindowTitle().
// NativeShellWindows should call this to determine what the window's title
// is on startup and from within UpdateWindowTitle().
virtual string16 GetTitle() const;
virtual void SetFullscreen(bool fullscreen) {}
virtual bool IsFullscreenOrPending() const;
// Called when the draggable regions are changed.
virtual void UpdateDraggableRegions(
const std::vector<extensions::DraggableRegion>& regions) {}
// Call to notify ShellRegistry and delete the window. Subclasses should
// invoke this method instead of using "delete this".
void OnNativeClose();
protected:
ShellWindow(Profile* profile,
const extensions::Extension* extension);
virtual ~ShellWindow();
private:
// PlatformAppBrowserTest needs access to web_contents()
friend class extensions::PlatformAppBrowserTest;
// Instantiates a platform-specific ShellWindow subclass (one implementation
// per platform). Public users of ShellWindow should use ShellWindow::Create.
static ShellWindow* CreateImpl(Profile* profile,
const extensions::Extension* extension,
const GURL& url,
const CreateParams& params);
void Init(const GURL& url, const CreateParams& params);
// content::WebContentsObserver implementation.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
......@@ -151,6 +144,9 @@ class ShellWindow : public content::NotificationObserver,
void AddMessageToDevToolsConsole(content::ConsoleMessageLevel level,
const std::string& message);
virtual void UpdateDraggableRegions(
const std::vector<extensions::DraggableRegion>& regions);
Profile* profile_; // weak pointer - owned by ProfileManager.
// weak pointer - owned by ExtensionService.
const extensions::Extension* extension_;
......@@ -162,6 +158,8 @@ class ShellWindow : public content::NotificationObserver,
content::NotificationRegistrar registrar_;
ExtensionFunctionDispatcher extension_function_dispatcher_;
scoped_ptr<NativeShellWindow> native_window_;
DISALLOW_COPY_AND_ASSIGN(ShellWindow);
};
......
......@@ -13,11 +13,9 @@
#include "ui/base/x/active_window_watcher_x.h"
#include "ui/gfx/rect.h"
ShellWindowGtk::ShellWindowGtk(Profile* profile,
const extensions::Extension* extension,
const GURL& url,
ShellWindowGtk::ShellWindowGtk(ShellWindow* shell_window,
const ShellWindow::CreateParams& params)
: ShellWindow(profile, extension, url),
: shell_window_(shell_window),
state_(GDK_WINDOW_STATE_WITHDRAWN),
is_active_(!ui::ActiveWindowWatcherX::WMSupportsActivation()),
content_thinks_its_fullscreen_(false) {
......@@ -59,7 +57,7 @@ ShellWindowGtk::ShellWindowGtk(Profile* profile,
}
// TODO(mihaip): Mirror contents of <title> tag in window title
gtk_window_set_title(window_, extension->name().c_str());
gtk_window_set_title(window_, extension()->name().c_str());
g_signal_connect(window_, "delete-event",
G_CALLBACK(OnMainWindowDeleteEventThunk), this);
......@@ -121,7 +119,7 @@ void ShellWindowGtk::Close() {
// OnNativeClose does a delete this so no other members should
// be accessed after. gtk_widget_destroy is safe (and must
// be last).
OnNativeClose();
shell_window_->OnNativeClose();
gtk_widget_destroy(window);
}
......@@ -220,10 +218,12 @@ bool ShellWindowGtk::IsFullscreenOrPending() const {
return content_thinks_its_fullscreen_;
}
void ShellWindowGtk::UpdateWindowTitle() {
// TODO(jeremya): implement.
}
// static
ShellWindow* ShellWindow::CreateImpl(Profile* profile,
const extensions::Extension* extension,
const GURL& url,
const ShellWindow::CreateParams& params) {
return new ShellWindowGtk(profile, extension, url, params);
NativeShellWindow* NativeShellWindow::Create(
ShellWindow* shell_window, const ShellWindow::CreateParams& params) {
return new ShellWindowGtk(shell_window, params);
}
......@@ -7,6 +7,7 @@
#include <gtk/gtk.h>
#include "chrome/browser/ui/extensions/native_shell_window.h"
#include "chrome/browser/ui/extensions/shell_window.h"
#include "chrome/browser/ui/gtk/extensions/extension_view_gtk.h"
#include "ui/base/gtk/gtk_signal.h"
......@@ -19,14 +20,12 @@ namespace extensions {
class Extension;
}
class ShellWindowGtk : public ShellWindow,
class ShellWindowGtk : public NativeShellWindow,
public ExtensionViewGtk::Container,
public ui::ActiveWindowWatcherXObserver {
public:
ShellWindowGtk(Profile* profile,
const extensions::Extension* extension,
const GURL& url,
const CreateParams& params);
ShellWindowGtk(ShellWindow* shell_window,
const ShellWindow::CreateParams& params);
// BaseWindow implementation.
virtual bool IsActive() const OVERRIDE;
......@@ -52,9 +51,17 @@ class ShellWindowGtk : public ShellWindow,
virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE;
private:
// ShellWindow implementation.
// NativeShellWindow implementation.
virtual void SetFullscreen(bool fullscreen) OVERRIDE;
virtual bool IsFullscreenOrPending() const OVERRIDE;
virtual void UpdateWindowTitle() OVERRIDE;
content::WebContents* web_contents() const {
return shell_window_->web_contents();
}
const extensions::Extension* extension() const {
return shell_window_->extension();
}
virtual ~ShellWindowGtk();
......@@ -65,6 +72,8 @@ class ShellWindowGtk : public ShellWindow,
CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnWindowState,
GdkEventWindowState*);
ShellWindow* shell_window_; // weak - ShellWindow owns NativeShellWindow.
GtkWindow* window_;
GdkWindowState state_;
......
......@@ -302,11 +302,9 @@ void ShellWindowFrameView::ButtonPressed(views::Button* sender,
frame_->Close();
}
ShellWindowViews::ShellWindowViews(Profile* profile,
const extensions::Extension* extension,
const GURL& url,
ShellWindowViews::ShellWindowViews(ShellWindow* shell_window,
const ShellWindow::CreateParams& win_params)
: ShellWindow(profile, extension, url),
: shell_window_(shell_window),
web_view_(NULL),
is_fullscreen_(false),
frameless_(win_params.frame == ShellWindow::CreateParams::FRAME_NONE) {
......@@ -323,10 +321,10 @@ ShellWindowViews::ShellWindowViews(Profile* profile,
window_->SetBounds(window_bounds);
#if defined(OS_WIN) && !defined(USE_AURA)
std::string app_name = web_app::GenerateApplicationNameFromExtensionId(
extension->id());
extension()->id());
ui::win::SetAppIdForWindow(
ShellIntegration::GetAppModelIdForProfile(UTF8ToWide(app_name),
profile->GetPath()),
ShellIntegration::GetAppModelIdForProfile(
UTF8ToWide(app_name), shell_window_->profile()->GetPath()),
GetWidget()->GetTopLevelWidget()->GetNativeWindow());
#endif
OnViewWasResized();
......@@ -455,7 +453,7 @@ bool ShellWindowViews::IsAlwaysOnTop() const {
}
void ShellWindowViews::DeleteDelegate() {
OnNativeClose();
shell_window_->OnNativeClose();
}
bool ShellWindowViews::CanResize() const {
......@@ -478,7 +476,7 @@ views::NonClientFrameView* ShellWindowViews::CreateNonClientFrameView(
}
string16 ShellWindowViews::GetWindowTitle() const {
return GetTitle();
return shell_window_->GetTitle();
}
views::Widget* ShellWindowViews::GetWidget() {
......@@ -536,7 +534,8 @@ void ShellWindowViews::OnViewWasResized() {
SkRegion::kUnion_Op);
}
}
web_contents()->GetRenderViewHost()->GetView()->SetClickthroughRegion(rgn);
if (web_contents()->GetRenderViewHost()->GetView())
web_contents()->GetRenderViewHost()->GetView()->SetClickthroughRegion(rgn);
#endif
}
......@@ -580,9 +579,7 @@ void ShellWindowViews::UpdateDraggableRegions(
}
// static
ShellWindow* ShellWindow::CreateImpl(Profile* profile,
const extensions::Extension* extension,
const GURL& url,
const ShellWindow::CreateParams& params) {
return new ShellWindowViews(profile, extension, url, params);
NativeShellWindow* NativeShellWindow::Create(
ShellWindow* shell_window, const ShellWindow::CreateParams& params) {
return new ShellWindowViews(shell_window, params);
}
......@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_VIEWS_H_
#define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_VIEWS_H_
#include "chrome/browser/ui/base_window.h"
#include "chrome/browser/ui/extensions/native_shell_window.h"
#include "chrome/browser/ui/extensions/shell_window.h"
#include "third_party/skia/include/core/SkRegion.h"
#include "ui/gfx/rect.h"
......@@ -12,6 +14,10 @@
class Profile;
namespace content {
class WebContents;
}
namespace extensions {
class Extension;
struct DraggableRegion;
......@@ -21,13 +27,11 @@ namespace views {
class WebView;
}
class ShellWindowViews : public ShellWindow,
class ShellWindowViews : public NativeShellWindow,
public views::WidgetDelegateView {
public:
ShellWindowViews(Profile* profile,
const extensions::Extension* extension,
const GURL& url,
const CreateParams& params);
ShellWindowViews(ShellWindow* shell_window,
const ShellWindow::CreateParams& params);
bool frameless() const { return frameless_; }
SkRegion* draggable_region() { return draggable_region_.get(); }
......@@ -73,12 +77,20 @@ class ShellWindowViews : public ShellWindow,
virtual gfx::Size GetMaximumSize() OVERRIDE;
virtual void OnFocus() OVERRIDE;
Profile* profile() { return shell_window_->profile(); }
content::WebContents* web_contents() {
return shell_window_->web_contents();
}
const extensions::Extension* extension() {
return shell_window_->extension();
}
private:
friend class ShellWindowFrameView;
virtual ~ShellWindowViews();
// ShellWindow implementation.
// NativeShellWindow implementation.
virtual void UpdateWindowTitle() OVERRIDE;
virtual void SetFullscreen(bool fullscreen) OVERRIDE;
virtual bool IsFullscreenOrPending() const OVERRIDE;
......@@ -87,6 +99,8 @@ class ShellWindowViews : public ShellWindow,
void OnViewWasResized();
ShellWindow* shell_window_; // weak - ShellWindow owns NativeShellWindow.
views::WebView* web_view_;
views::Widget* window_;
bool is_fullscreen_;
......
......@@ -283,7 +283,7 @@ void SelectFileDialogExtension::SelectFileImpl(
ShellWindow* shell_window = registry->GetShellWindowForNativeWindow(
owner_window);
if (shell_window) {
base_window = shell_window;
base_window = shell_window->GetBaseWindow();
tab = shell_window->tab_contents();
profile_ = *i;
break;
......
......@@ -3050,6 +3050,7 @@
'browser/ui/crypto_module_password_dialog_openssl.cc',
'browser/ui/extensions/application_launch.cc',
'browser/ui/extensions/application_launch.h',
'browser/ui/extensions/native_shell_window.h',
'browser/ui/extensions/shell_window.cc',
'browser/ui/extensions/shell_window.h',
'browser/ui/find_bar/find_bar.h',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment