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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
253 !is_panel; | 253 !is_panel; |
254 case windows::WINDOW_STATE_NORMAL: | 254 case windows::WINDOW_STATE_NORMAL: |
255 case windows::WINDOW_STATE_DOCKED: | 255 case windows::WINDOW_STATE_DOCKED: |
256 case windows::WINDOW_STATE_NONE: | 256 case windows::WINDOW_STATE_NONE: |
257 return true; | 257 return true; |
258 } | 258 } |
259 NOTREACHED(); | 259 NOTREACHED(); |
260 return true; | 260 return true; |
261 } | 261 } |
262 | 262 |
263 #if defined(USE_ASH) | |
263 bool IsHangoutsExtensionId(const std::string& extension_id) { | 264 bool IsHangoutsExtensionId(const std::string& extension_id) { |
Devlin
2016/08/25 20:51:06
Since this is only used in one location, maybe we
| |
264 for (const char* id : extension_misc::kHangoutsExtensionIds) { | 265 for (const char* id : extension_misc::kHangoutsExtensionIds) { |
265 if (extension_id == id) | 266 if (extension_id == id) |
266 return true; | 267 return true; |
267 } | 268 } |
268 return false; | 269 return false; |
269 } | 270 } |
271 #endif | |
270 | 272 |
271 } // namespace | 273 } // namespace |
272 | 274 |
273 void ZoomModeToZoomSettings(ZoomController::ZoomMode zoom_mode, | 275 void ZoomModeToZoomSettings(ZoomController::ZoomMode zoom_mode, |
274 api::tabs::ZoomSettings* zoom_settings) { | 276 api::tabs::ZoomSettings* zoom_settings) { |
275 DCHECK(zoom_settings); | 277 DCHECK(zoom_settings); |
276 switch (zoom_mode) { | 278 switch (zoom_mode) { |
277 case ZoomController::ZOOM_MODE_DEFAULT: | 279 case ZoomController::ZOOM_MODE_DEFAULT: |
278 zoom_settings->mode = api::tabs::ZOOM_SETTINGS_MODE_AUTOMATIC; | 280 zoom_settings->mode = api::tabs::ZOOM_SETTINGS_MODE_AUTOMATIC; |
279 zoom_settings->scope = api::tabs::ZOOM_SETTINGS_SCOPE_PER_ORIGIN; | 281 zoom_settings->scope = api::tabs::ZOOM_SETTINGS_SCOPE_PER_ORIGIN; |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
513 } | 515 } |
514 | 516 |
515 Browser::Type window_type = Browser::TYPE_TABBED; | 517 Browser::Type window_type = Browser::TYPE_TABBED; |
516 | 518 |
517 #if defined(USE_ASH) | 519 #if defined(USE_ASH) |
518 bool create_ash_panel = false; | 520 bool create_ash_panel = false; |
519 #endif // defined(USE_ASH) | 521 #endif // defined(USE_ASH) |
520 | 522 |
521 gfx::Rect window_bounds; | 523 gfx::Rect window_bounds; |
522 bool focused = true; | 524 bool focused = true; |
525 #if defined(USE_ASH) | |
523 bool saw_focus_key = false; | 526 bool saw_focus_key = false; |
Devlin
2016/08/25 20:51:06
can we put this on line 521 so that it's in the sa
| |
527 #endif | |
524 std::string extension_id; | 528 std::string extension_id; |
525 | 529 |
526 if (create_data) { | 530 if (create_data) { |
527 // Figure out window type before figuring out bounds so that default | 531 // Figure out window type before figuring out bounds so that default |
528 // bounds can be set according to the window type. | 532 // bounds can be set according to the window type. |
529 switch (create_data->type) { | 533 switch (create_data->type) { |
530 case windows::CREATE_TYPE_POPUP: | 534 case windows::CREATE_TYPE_POPUP: |
531 window_type = Browser::TYPE_POPUP; | 535 window_type = Browser::TYPE_POPUP; |
532 extension_id = extension()->id(); | 536 extension_id = extension()->id(); |
533 break; | 537 break; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
586 window_bounds.set_y(*create_data->top); | 590 window_bounds.set_y(*create_data->top); |
587 | 591 |
588 if (create_data->width) | 592 if (create_data->width) |
589 window_bounds.set_width(*create_data->width); | 593 window_bounds.set_width(*create_data->width); |
590 | 594 |
591 if (create_data->height) | 595 if (create_data->height) |
592 window_bounds.set_height(*create_data->height); | 596 window_bounds.set_height(*create_data->height); |
593 | 597 |
594 if (create_data->focused) { | 598 if (create_data->focused) { |
595 focused = *create_data->focused; | 599 focused = *create_data->focused; |
600 #if defined(USE_ASH) | |
596 saw_focus_key = true; | 601 saw_focus_key = true; |
602 #endif | |
597 } | 603 } |
598 } | 604 } |
599 | 605 |
600 #if defined(USE_ASH) | 606 #if defined(USE_ASH) |
601 if (create_ash_panel) { | 607 if (create_ash_panel) { |
602 if (urls.empty()) | 608 if (urls.empty()) |
603 urls.push_back(GURL(chrome::kChromeUINewTabURL)); | 609 urls.push_back(GURL(chrome::kChromeUINewTabURL)); |
604 | 610 |
605 AppWindow::CreateParams create_params; | 611 AppWindow::CreateParams create_params; |
606 create_params.window_type = AppWindow::WINDOW_TYPE_V1_PANEL; | 612 create_params.window_type = AppWindow::WINDOW_TYPE_V1_PANEL; |
(...skipping 1580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2187 params->tab_id | 2193 params->tab_id |
2188 ? ErrorUtils::FormatErrorMessage(keys::kCannotDiscardTab, | 2194 ? ErrorUtils::FormatErrorMessage(keys::kCannotDiscardTab, |
2189 base::IntToString(*params->tab_id)) | 2195 base::IntToString(*params->tab_id)) |
2190 : keys::kCannotFindTabToDiscard)); | 2196 : keys::kCannotFindTabToDiscard)); |
2191 } | 2197 } |
2192 | 2198 |
2193 TabsDiscardFunction::TabsDiscardFunction() {} | 2199 TabsDiscardFunction::TabsDiscardFunction() {} |
2194 TabsDiscardFunction::~TabsDiscardFunction() {} | 2200 TabsDiscardFunction::~TabsDiscardFunction() {} |
2195 | 2201 |
2196 } // namespace extensions | 2202 } // namespace extensions |
OLD | NEW |