summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui
diff options
context:
space:
mode:
authorjeremya@chromium.org <jeremya@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-25 04:59:15 +0000
committerjeremya@chromium.org <jeremya@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-25 04:59:15 +0000
commit7d412f74d3cb9166de934209d4e366e8aef5b7bf (patch)
tree4337b0a0680aa2cc613ad5b29967f30468c408e2 /chrome/browser/ui
parent179fe754b91c9ca114287186743483cc1754a47f (diff)
downloadchromium_src-7d412f74d3cb9166de934209d4e366e8aef5b7bf.zip
chromium_src-7d412f74d3cb9166de934209d4e366e8aef5b7bf.tar.gz
chromium_src-7d412f74d3cb9166de934209d4e366e8aef5b7bf.tar.bz2
Add a 'hidden' option to chrome.app.window.create()
This also adds AppWindow.show()/hide(), to manipulate the visibility of the window once it has been created. R=asargent@chromium.org,ben@chromium.org BUG=131742 Review URL: https://chromiumcodereview.appspot.com/11147037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164016 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui')
-rw-r--r--chrome/browser/ui/base_window.h3
-rw-r--r--chrome/browser/ui/cocoa/browser_window_cocoa.h1
-rw-r--r--chrome/browser/ui/cocoa/browser_window_cocoa.mm4
-rw-r--r--chrome/browser/ui/cocoa/extensions/shell_window_cocoa.h1
-rw-r--r--chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm4
-rw-r--r--chrome/browser/ui/extensions/shell_window.cc5
-rw-r--r--chrome/browser/ui/extensions/shell_window.h3
-rw-r--r--chrome/browser/ui/gtk/browser_window_gtk.cc4
-rw-r--r--chrome/browser/ui/gtk/browser_window_gtk.h1
-rw-r--r--chrome/browser/ui/gtk/extensions/shell_window_gtk.cc4
-rw-r--r--chrome/browser/ui/gtk/extensions/shell_window_gtk.h1
-rw-r--r--chrome/browser/ui/panels/panel.cc4
-rw-r--r--chrome/browser/ui/panels/panel.h1
-rw-r--r--chrome/browser/ui/views/extensions/shell_window_views.cc6
-rw-r--r--chrome/browser/ui/views/extensions/shell_window_views.h1
-rw-r--r--chrome/browser/ui/views/frame/browser_view.cc4
-rw-r--r--chrome/browser/ui/views/frame/browser_view.h1
17 files changed, 45 insertions, 3 deletions
diff --git a/chrome/browser/ui/base_window.h b/chrome/browser/ui/base_window.h
index 70c8ce6..deaa700 100644
--- a/chrome/browser/ui/base_window.h
+++ b/chrome/browser/ui/base_window.h
@@ -46,6 +46,9 @@ class BaseWindow {
// Shows the window, or activates it if it's already visible.
virtual void Show() = 0;
+ // Hides the window.
+ virtual void Hide() = 0;
+
// Show the window, but do not activate it. Does nothing if window
// is already visible.
virtual void ShowInactive() = 0;
diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.h b/chrome/browser/ui/cocoa/browser_window_cocoa.h
index 1b88cb6..d815aba 100644
--- a/chrome/browser/ui/cocoa/browser_window_cocoa.h
+++ b/chrome/browser/ui/cocoa/browser_window_cocoa.h
@@ -42,6 +42,7 @@ class BrowserWindowCocoa :
// Overridden from BrowserWindow
virtual void Show() OVERRIDE;
virtual void ShowInactive() OVERRIDE;
+ virtual void Hide() OVERRIDE;
virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
virtual void Close() OVERRIDE;
virtual void Activate() OVERRIDE;
diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_cocoa.mm
index a637f6f..b15fb7c 100644
--- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm
+++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm
@@ -145,6 +145,10 @@ void BrowserWindowCocoa::ShowInactive() {
[window() orderFront:controller_];
}
+void BrowserWindowCocoa::Hide() {
+ // Not implemented.
+}
+
void BrowserWindowCocoa::SetBounds(const gfx::Rect& bounds) {
gfx::Rect real_bounds = [controller_ enforceMinWindowSize:bounds];
diff --git a/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.h b/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.h
index 01b0288..a719741 100644
--- a/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.h
+++ b/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.h
@@ -61,6 +61,7 @@ class ShellWindowCocoa : public NativeShellWindow {
virtual gfx::Rect GetBounds() const OVERRIDE;
virtual void Show() OVERRIDE;
virtual void ShowInactive() OVERRIDE;
+ virtual void Hide() OVERRIDE;
virtual void Close() OVERRIDE;
virtual void Activate() OVERRIDE;
virtual void Deactivate() OVERRIDE;
diff --git a/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm b/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm
index 917b827..a87b7ca 100644
--- a/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm
+++ b/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm
@@ -397,6 +397,10 @@ void ShellWindowCocoa::ShowInactive() {
[window() orderFront:window_controller_];
}
+void ShellWindowCocoa::Hide() {
+ [window() orderOut:window_controller_];
+}
+
void ShellWindowCocoa::Close() {
[window() performClose:nil];
}
diff --git a/chrome/browser/ui/extensions/shell_window.cc b/chrome/browser/ui/extensions/shell_window.cc
index 4b61960..a8c1bb9 100644
--- a/chrome/browser/ui/extensions/shell_window.cc
+++ b/chrome/browser/ui/extensions/shell_window.cc
@@ -71,7 +71,7 @@ ShellWindow::CreateParams::CreateParams()
: frame(ShellWindow::CreateParams::FRAME_CHROME),
bounds(-1, -1, kDefaultWidth, kDefaultHeight),
restore_position(true), restore_size(true),
- creator_process_id(0) {
+ creator_process_id(0), hidden(false) {
}
ShellWindow::CreateParams::~CreateParams() {
@@ -115,6 +115,9 @@ void ShellWindow::Init(const GURL& url,
native_window_.reset(NativeShellWindow::Create(this, params));
+ if (!params.hidden)
+ GetBaseWindow()->Show();
+
if (!params.window_key.empty()) {
window_key_ = params.window_key;
diff --git a/chrome/browser/ui/extensions/shell_window.h b/chrome/browser/ui/extensions/shell_window.h
index 3aa30fd..231bb62 100644
--- a/chrome/browser/ui/extensions/shell_window.h
+++ b/chrome/browser/ui/extensions/shell_window.h
@@ -68,6 +68,9 @@ class ShellWindow : public content::NotificationObserver,
// The process ID of the process that requested the create.
int32 creator_process_id;
+
+ // If true, don't show the window after creation.
+ bool hidden;
};
static ShellWindow* Create(Profile* profile,
diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc
index 314feac..2ae6951 100644
--- a/chrome/browser/ui/gtk/browser_window_gtk.cc
+++ b/chrome/browser/ui/gtk/browser_window_gtk.cc
@@ -610,6 +610,10 @@ void BrowserWindowGtk::ShowInactive() {
gtk_widget_show(GTK_WIDGET(window_));
}
+void BrowserWindowGtk::Hide() {
+ // Not implemented.
+}
+
void BrowserWindowGtk::SetBoundsImpl(const gfx::Rect& bounds,
bool exterior,
bool move) {
diff --git a/chrome/browser/ui/gtk/browser_window_gtk.h b/chrome/browser/ui/gtk/browser_window_gtk.h
index 234a3cf..952c7dc 100644
--- a/chrome/browser/ui/gtk/browser_window_gtk.h
+++ b/chrome/browser/ui/gtk/browser_window_gtk.h
@@ -73,6 +73,7 @@ class BrowserWindowGtk
// Overridden from BrowserWindow:
virtual void Show() OVERRIDE;
virtual void ShowInactive() OVERRIDE;
+ virtual void Hide() OVERRIDE;
virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
virtual void Close() OVERRIDE;
virtual void Activate() OVERRIDE;
diff --git a/chrome/browser/ui/gtk/extensions/shell_window_gtk.cc b/chrome/browser/ui/gtk/extensions/shell_window_gtk.cc
index 5a926ad..bba8a74 100644
--- a/chrome/browser/ui/gtk/extensions/shell_window_gtk.cc
+++ b/chrome/browser/ui/gtk/extensions/shell_window_gtk.cc
@@ -168,6 +168,10 @@ void ShellWindowGtk::ShowInactive() {
gtk_widget_show(GTK_WIDGET(window_));
}
+void ShellWindowGtk::Hide() {
+ gtk_widget_hide(GTK_WIDGET(window_));
+}
+
void ShellWindowGtk::Close() {
shell_window_->SaveWindowPosition();
diff --git a/chrome/browser/ui/gtk/extensions/shell_window_gtk.h b/chrome/browser/ui/gtk/extensions/shell_window_gtk.h
index 67226aa..bcd1f38 100644
--- a/chrome/browser/ui/gtk/extensions/shell_window_gtk.h
+++ b/chrome/browser/ui/gtk/extensions/shell_window_gtk.h
@@ -40,6 +40,7 @@ class ShellWindowGtk : public NativeShellWindow,
virtual gfx::Rect GetBounds() const OVERRIDE;
virtual void Show() OVERRIDE;
virtual void ShowInactive() OVERRIDE;
+ virtual void Hide() OVERRIDE;
virtual void Close() OVERRIDE;
virtual void Activate() OVERRIDE;
virtual void Deactivate() OVERRIDE;
diff --git a/chrome/browser/ui/panels/panel.cc b/chrome/browser/ui/panels/panel.cc
index 32812a9..be52d97 100644
--- a/chrome/browser/ui/panels/panel.cc
+++ b/chrome/browser/ui/panels/panel.cc
@@ -419,6 +419,10 @@ void Panel::ShowInactive() {
native_panel_->ShowPanelInactive();
}
+void Panel::Hide() {
+ // Not implemented.
+}
+
void Panel::SetBounds(const gfx::Rect& bounds) {
// Ignore bounds position as the panel manager controls all positioning.
if (!panel_strip_)
diff --git a/chrome/browser/ui/panels/panel.h b/chrome/browser/ui/panels/panel.h
index b913e1d..6264e97 100644
--- a/chrome/browser/ui/panels/panel.h
+++ b/chrome/browser/ui/panels/panel.h
@@ -123,6 +123,7 @@ class Panel : public BaseWindow,
virtual gfx::Rect GetBounds() const OVERRIDE;
virtual void Show() OVERRIDE;
virtual void ShowInactive() OVERRIDE;
+ virtual void Hide() OVERRIDE;
virtual void Close() OVERRIDE;
virtual void Activate() OVERRIDE;
virtual void Deactivate() OVERRIDE;
diff --git a/chrome/browser/ui/views/extensions/shell_window_views.cc b/chrome/browser/ui/views/extensions/shell_window_views.cc
index bceea4e..3928d97 100644
--- a/chrome/browser/ui/views/extensions/shell_window_views.cc
+++ b/chrome/browser/ui/views/extensions/shell_window_views.cc
@@ -353,8 +353,6 @@ ShellWindowViews::ShellWindowViews(ShellWindow* shell_window,
shell_window_));
OnViewWasResized();
-
- window_->Show();
}
views::View* ShellWindowViews::GetInitiallyFocusedView() {
@@ -455,6 +453,10 @@ void ShellWindowViews::ShowInactive() {
window_->ShowInactive();
}
+void ShellWindowViews::Hide() {
+ window_->Hide();
+}
+
void ShellWindowViews::Close() {
window_->Close();
}
diff --git a/chrome/browser/ui/views/extensions/shell_window_views.h b/chrome/browser/ui/views/extensions/shell_window_views.h
index 80c5fc5..7f5e1f6 100644
--- a/chrome/browser/ui/views/extensions/shell_window_views.h
+++ b/chrome/browser/ui/views/extensions/shell_window_views.h
@@ -48,6 +48,7 @@ class ShellWindowViews : public NativeShellWindow,
virtual gfx::Rect GetBounds() const OVERRIDE;
virtual void Show() OVERRIDE;
virtual void ShowInactive() OVERRIDE;
+ virtual void Hide() OVERRIDE;
virtual void Close() OVERRIDE;
virtual void Activate() OVERRIDE;
virtual void Deactivate() OVERRIDE;
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index 54f2ec6..b67952d 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -618,6 +618,10 @@ void BrowserView::ShowInactive() {
frame_->ShowInactive();
}
+void BrowserView::Hide() {
+ // Not implemented.
+}
+
void BrowserView::SetBounds(const gfx::Rect& bounds) {
ExitFullscreen();
GetWidget()->SetBounds(bounds);
diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h
index c5905c8..3edbd93 100644
--- a/chrome/browser/ui/views/frame/browser_view.h
+++ b/chrome/browser/ui/views/frame/browser_view.h
@@ -237,6 +237,7 @@ class BrowserView : public BrowserWindow,
// Overridden from BrowserWindow:
virtual void Show() OVERRIDE;
virtual void ShowInactive() OVERRIDE;
+ virtual void Hide() OVERRIDE;
virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
virtual void Close() OVERRIDE;
virtual void Activate() OVERRIDE;