| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/extensions/api/tabs/tabs_api.h" | 5 #include "chrome/browser/extensions/api/tabs/tabs_api.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 return ui::SHOW_STATE_DEFAULT; | 218 return ui::SHOW_STATE_DEFAULT; |
| 219 } | 219 } |
| 220 | 220 |
| 221 bool IsValidStateForWindowsCreateFunction( | 221 bool IsValidStateForWindowsCreateFunction( |
| 222 const windows::Create::Params::CreateData* create_data) { | 222 const windows::Create::Params::CreateData* create_data) { |
| 223 if (!create_data) | 223 if (!create_data) |
| 224 return true; | 224 return true; |
| 225 | 225 |
| 226 bool has_bound = create_data->left || create_data->top || | 226 bool has_bound = create_data->left || create_data->top || |
| 227 create_data->width || create_data->height; | 227 create_data->width || create_data->height; |
| 228 bool is_panel = | 228 bool is_panel = create_data->type == windows::CreateType::CREATE_TYPE_PANEL; |
| 229 create_data->type == windows::CreateType::CREATE_TYPE_PANEL || | |
| 230 create_data->type == windows::CreateType::CREATE_TYPE_DETACHED_PANEL; | |
| 231 | 229 |
| 232 switch (create_data->state) { | 230 switch (create_data->state) { |
| 233 case windows::WINDOW_STATE_MINIMIZED: | 231 case windows::WINDOW_STATE_MINIMIZED: |
| 234 // If minimised, default focused state should be unfocused. | 232 // If minimised, default focused state should be unfocused. |
| 235 return !(create_data->focused && *create_data->focused) && !has_bound && | 233 return !(create_data->focused && *create_data->focused) && !has_bound && |
| 236 !is_panel; | 234 !is_panel; |
| 237 case windows::WINDOW_STATE_MAXIMIZED: | 235 case windows::WINDOW_STATE_MAXIMIZED: |
| 238 case windows::WINDOW_STATE_FULLSCREEN: | 236 case windows::WINDOW_STATE_FULLSCREEN: |
| 239 // If maximised/fullscreen, default focused state should be focused. | 237 // If maximised/fullscreen, default focused state should be focused. |
| 240 return !(create_data->focused && !*create_data->focused) && !has_bound && | 238 return !(create_data->focused && !*create_data->focused) && !has_bound && |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 | 491 |
| 494 if (create_data) { | 492 if (create_data) { |
| 495 // Figure out window type before figuring out bounds so that default | 493 // Figure out window type before figuring out bounds so that default |
| 496 // bounds can be set according to the window type. | 494 // bounds can be set according to the window type. |
| 497 switch (create_data->type) { | 495 switch (create_data->type) { |
| 498 case windows::CREATE_TYPE_POPUP: | 496 case windows::CREATE_TYPE_POPUP: |
| 499 window_type = Browser::TYPE_POPUP; | 497 window_type = Browser::TYPE_POPUP; |
| 500 extension_id = extension()->id(); | 498 extension_id = extension()->id(); |
| 501 break; | 499 break; |
| 502 | 500 |
| 503 case windows::CREATE_TYPE_PANEL: | 501 case windows::CREATE_TYPE_PANEL: { |
| 504 case windows::CREATE_TYPE_DETACHED_PANEL: { | |
| 505 extension_id = extension()->id(); | 502 extension_id = extension()->id(); |
| 506 #if defined(USE_ASH) | 503 #if defined(USE_ASH) |
| 507 // Only ChromeOS' version of chrome.windows.create would create a panel | 504 // Only ChromeOS' version of chrome.windows.create would create a panel |
| 508 // window. It is whitelisted to Hangouts extension for limited time until | 505 // window. It is whitelisted to Hangouts extension for limited time until |
| 509 // it transitioned to other types of windows. | 506 // it transitioned to other types of windows. |
| 510 for (const char* id : extension_misc::kHangoutsExtensionIds) { | 507 for (const char* id : extension_misc::kHangoutsExtensionIds) { |
| 511 if (extension_id == id) { | 508 if (extension_id == id) { |
| 512 create_ash_panel = true; | 509 create_ash_panel = true; |
| 513 break; | 510 break; |
| 514 } | 511 } |
| (...skipping 1580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2095 params->tab_id | 2092 params->tab_id |
| 2096 ? ErrorUtils::FormatErrorMessage(keys::kCannotDiscardTab, | 2093 ? ErrorUtils::FormatErrorMessage(keys::kCannotDiscardTab, |
| 2097 base::IntToString(*params->tab_id)) | 2094 base::IntToString(*params->tab_id)) |
| 2098 : keys::kCannotFindTabToDiscard)); | 2095 : keys::kCannotFindTabToDiscard)); |
| 2099 } | 2096 } |
| 2100 | 2097 |
| 2101 TabsDiscardFunction::TabsDiscardFunction() {} | 2098 TabsDiscardFunction::TabsDiscardFunction() {} |
| 2102 TabsDiscardFunction::~TabsDiscardFunction() {} | 2099 TabsDiscardFunction::~TabsDiscardFunction() {} |
| 2103 | 2100 |
| 2104 } // namespace extensions | 2101 } // namespace extensions |
| OLD | NEW |