Chromium Code Reviews| Index: chrome/browser/extensions/api/tabs/tabs_api.cc |
| diff --git a/chrome/browser/extensions/api/tabs/tabs_api.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc |
| index 229d89aaed2445c1b428504800768e261b4dedac..2e31a04daa9073c2c293fdf22ecc8c1c28698d67 100644 |
| --- a/chrome/browser/extensions/api/tabs/tabs_api.cc |
| +++ b/chrome/browser/extensions/api/tabs/tabs_api.cc |
| @@ -181,6 +181,23 @@ void AssignOptionalValue(const scoped_ptr<T>& source, |
| } |
| } |
| +ui::WindowShowState ConvertToWindowShowState(windows::State state) { |
| + switch (state) { |
| + case windows::STATE_NORMAL: |
| + return ui::SHOW_STATE_NORMAL; |
| + case windows::STATE_MINIMIZED: |
| + return ui::SHOW_STATE_MINIMIZED; |
| + case windows::STATE_MAXIMIZED: |
| + return ui::SHOW_STATE_MAXIMIZED; |
| + case windows::STATE_FULLSCREEN: |
| + return ui::SHOW_STATE_FULLSCREEN; |
| + case windows::STATE_NONE: |
| + return ui::SHOW_STATE_DEFAULT; |
| + } |
| + NOTREACHED(); |
| + return ui::SHOW_STATE_DEFAULT; |
| +} |
| + |
| } // namespace |
| void ZoomModeToZoomSettings(ZoomController::ZoomMode zoom_mode, |
| @@ -559,6 +576,10 @@ bool WindowsCreateFunction::RunSync() { |
| host_desktop_type); |
| } |
| create_params.initial_show_state = ui::SHOW_STATE_NORMAL; |
| + if (create_data && create_data->state) { |
| + create_params.initial_show_state = |
| + ConvertToWindowShowState(create_data->state); |
| + } |
| create_params.host_desktop_type = chrome::GetActiveDesktop(); |
| Browser* new_window = new Browser(create_params); |
| @@ -595,6 +616,13 @@ bool WindowsCreateFunction::RunSync() { |
| if (!saw_focus_key && create_panel) |
| focused = false; |
| + WindowController* controller = new_window->extension_window_controller(); |
| + if (create_params.initial_show_state == ui::SHOW_STATE_FULLSCREEN) |
| + controller->SetFullscreenMode(true, extension()->url()); |
|
not at google - send to devlin
2015/03/19 17:56:31
Can you double-check this works? I'm just wonderin
limasdf
2015/03/20 17:03:46
It works well. and even more natural. If I move th
|
| + |
| + if (create_params.initial_show_state == ui::SHOW_STATE_MINIMIZED) |
|
not at google - send to devlin
2015/03/19 17:56:31
Also, also double checking: do you need to manuall
limasdf
2015/03/20 17:03:46
=> do you need to manually Minimize()/Maximize() t
limasdf
2015/03/21 09:31:34
The initial show state doesn't automatically Minim
|
| + focused = false; |
| + |
| if (focused) |
| new_window->window()->Show(); |
| else |
| @@ -606,9 +634,7 @@ bool WindowsCreateFunction::RunSync() { |
| // profile and CanCrossIncognito isn't allowed. |
| SetResult(base::Value::CreateNullValue()); |
| } else { |
| - SetResult( |
| - new_window->extension_window_controller()->CreateWindowValueWithTabs( |
| - extension())); |
| + SetResult(controller->CreateWindowValueWithTabs(extension())); |
| } |
| return true; |
| @@ -624,26 +650,8 @@ bool WindowsUpdateFunction::RunSync() { |
| &controller)) |
| return false; |
| - ui::WindowShowState show_state = ui::SHOW_STATE_DEFAULT; // No change. |
| - switch (params->update_info.state) { |
| - case windows::Update::Params::UpdateInfo::STATE_NORMAL: |
| - show_state = ui::SHOW_STATE_NORMAL; |
| - break; |
| - case windows::Update::Params::UpdateInfo::STATE_MINIMIZED: |
| - show_state = ui::SHOW_STATE_MINIMIZED; |
| - break; |
| - case windows::Update::Params::UpdateInfo::STATE_MAXIMIZED: |
| - show_state = ui::SHOW_STATE_MAXIMIZED; |
| - break; |
| - case windows::Update::Params::UpdateInfo::STATE_FULLSCREEN: |
| - show_state = ui::SHOW_STATE_FULLSCREEN; |
| - break; |
| - case windows::Update::Params::UpdateInfo::STATE_NONE: |
| - break; |
| - default: |
| - error_ = keys::kInvalidWindowStateError; |
| - return false; |
| - } |
| + ui::WindowShowState show_state = |
| + ConvertToWindowShowState(params->update_info.state); |
| if (show_state != ui::SHOW_STATE_FULLSCREEN && |
| show_state != ui::SHOW_STATE_DEFAULT) |