Chromium Code Reviews| Index: chrome/browser/ui/extensions/shell_window.cc |
| diff --git a/chrome/browser/ui/extensions/shell_window.cc b/chrome/browser/ui/extensions/shell_window.cc |
| index 598ec498e5432c3758e60e69bc92f83e973c1e88..8e6fc71bd47de909968e03ebdfb9b73b7258ee24 100644 |
| --- a/chrome/browser/ui/extensions/shell_window.cc |
| +++ b/chrome/browser/ui/extensions/shell_window.cc |
| @@ -74,7 +74,8 @@ void SuspendRenderViewHost(RenderViewHost* rvh) { |
| } // namespace |
| ShellWindow::CreateParams::CreateParams() |
| - : frame(ShellWindow::CreateParams::FRAME_CHROME), |
| + : window_type(ShellWindow::WINDOW_TYPE_DEFAULT), |
| + frame(ShellWindow::FRAME_CHROME), |
| bounds(INT_MIN, INT_MIN, INT_MIN, INT_MIN), |
| creator_process_id(0), hidden(false) { |
| } |
| @@ -85,19 +86,21 @@ ShellWindow::CreateParams::~CreateParams() { |
| ShellWindow* ShellWindow::Create(Profile* profile, |
| const extensions::Extension* extension, |
| const GURL& url, |
| - const ShellWindow::CreateParams& params) { |
| + const CreateParams& params) { |
| // This object will delete itself when the window is closed. |
| - ShellWindow* window = new ShellWindow(profile, extension); |
| + ShellWindow* window = new ShellWindow(params.window_type, profile, extension); |
|
jeremya
2012/11/29 02:49:05
Probably better to read this out in Init() rather
stevenjb
2012/11/29 03:11:26
Agreed, done.
|
| window->Init(url, params); |
| extensions::ShellWindowRegistry::Get(profile)->AddShellWindow(window); |
| return window; |
| } |
| -ShellWindow::ShellWindow(Profile* profile, |
| +ShellWindow::ShellWindow(WindowType window_type, |
| + Profile* profile, |
| const extensions::Extension* extension) |
| : profile_(profile), |
| extension_(extension), |
| web_contents_(NULL), |
| + window_type_(window_type), |
| ALLOW_THIS_IN_INITIALIZER_LIST( |
| extension_function_dispatcher_(profile, this)) { |
| } |
| @@ -146,8 +149,12 @@ void ShellWindow::Init(const GURL& url, |
| native_app_window_.reset(NativeAppWindow::Create(this, new_params)); |
| OnNativeWindowChanged(); |
| - if (!params.hidden) |
| - GetBaseWindow()->Show(); |
| + if (!params.hidden) { |
| + if (params.window_type == WINDOW_TYPE_PANEL) |
| + GetBaseWindow()->ShowInactive(); // Panels are not activated by default. |
| + else |
| + GetBaseWindow()->Show(); |
| + } |
| // If the new view is in the same process as the creator, block the created |
| // RVH from loading anything until the background page has had a chance to do |
| @@ -324,7 +331,8 @@ 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 |
| // case, so we directly inspect the NavigationEntry's title. |
| - if (!web_contents()->GetController().GetActiveEntry() || |
| + if (!web_contents() || |
| + !web_contents()->GetController().GetActiveEntry() || |
| web_contents()->GetController().GetActiveEntry()->GetTitle().empty()) |
| return UTF8ToUTF16(extension()->name()); |
| string16 title = web_contents()->GetTitle(); |