Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: chrome/browser/extensions/api/tabs/tabs_api.cc

Issue 2275113003: Build error in chrome/browser/extensions/api/tabs/tabs_api.cc. (Closed)
Patch Set: Build error in chrome/browser/extensions/api/tabs/tabs_api.cc. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 bool IsHangoutsExtensionId(const std::string& extension_id) {
264 for (const char* id : extension_misc::kHangoutsExtensionIds) {
265 if (extension_id == id)
266 return true;
267 }
268 return false;
269 }
270
271 } // namespace 263 } // namespace
272 264
273 void ZoomModeToZoomSettings(ZoomController::ZoomMode zoom_mode, 265 void ZoomModeToZoomSettings(ZoomController::ZoomMode zoom_mode,
274 api::tabs::ZoomSettings* zoom_settings) { 266 api::tabs::ZoomSettings* zoom_settings) {
275 DCHECK(zoom_settings); 267 DCHECK(zoom_settings);
276 switch (zoom_mode) { 268 switch (zoom_mode) {
277 case ZoomController::ZOOM_MODE_DEFAULT: 269 case ZoomController::ZOOM_MODE_DEFAULT:
278 zoom_settings->mode = api::tabs::ZOOM_SETTINGS_MODE_AUTOMATIC; 270 zoom_settings->mode = api::tabs::ZOOM_SETTINGS_MODE_AUTOMATIC;
279 zoom_settings->scope = api::tabs::ZOOM_SETTINGS_SCOPE_PER_ORIGIN; 271 zoom_settings->scope = api::tabs::ZOOM_SETTINGS_SCOPE_PER_ORIGIN;
280 break; 272 break;
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 501
510 if (!IsValidStateForWindowsCreateFunction(create_data)) { 502 if (!IsValidStateForWindowsCreateFunction(create_data)) {
511 error_ = keys::kInvalidWindowStateError; 503 error_ = keys::kInvalidWindowStateError;
512 return false; 504 return false;
513 } 505 }
514 506
515 Browser::Type window_type = Browser::TYPE_TABBED; 507 Browser::Type window_type = Browser::TYPE_TABBED;
516 508
517 #if defined(USE_ASH) 509 #if defined(USE_ASH)
518 bool create_ash_panel = false; 510 bool create_ash_panel = false;
511 bool saw_focus_key = false;
519 #endif // defined(USE_ASH) 512 #endif // defined(USE_ASH)
520 513
521 gfx::Rect window_bounds; 514 gfx::Rect window_bounds;
522 bool focused = true; 515 bool focused = true;
523 bool saw_focus_key = false;
524 std::string extension_id; 516 std::string extension_id;
525 517
526 if (create_data) { 518 if (create_data) {
527 // Figure out window type before figuring out bounds so that default 519 // Figure out window type before figuring out bounds so that default
528 // bounds can be set according to the window type. 520 // bounds can be set according to the window type.
529 switch (create_data->type) { 521 switch (create_data->type) {
530 case windows::CREATE_TYPE_POPUP: 522 case windows::CREATE_TYPE_POPUP:
531 window_type = Browser::TYPE_POPUP; 523 window_type = Browser::TYPE_POPUP;
532 extension_id = extension()->id(); 524 extension_id = extension()->id();
533 break; 525 break;
534 526
535 case windows::CREATE_TYPE_PANEL: 527 case windows::CREATE_TYPE_PANEL:
536 case windows::CREATE_TYPE_DETACHED_PANEL: { 528 case windows::CREATE_TYPE_DETACHED_PANEL: {
537 extension_id = extension()->id(); 529 extension_id = extension()->id();
538 #if defined(USE_ASH) 530 #if defined(USE_ASH)
539 // Only ChromeOS' version of chrome.windows.create would create a panel 531 // Only ChromeOS' version of chrome.windows.create would create a panel
540 // window. It is whitelisted to Hangouts extension for limited time until 532 // window. It is whitelisted to Hangouts extension for limited time until
541 // it transitioned to other types of windows. 533 // it transitioned to other types of windows.
542 if (IsHangoutsExtensionId(extension_id)) { 534 for (const char* id : extension_misc::kHangoutsExtensionIds) {
543 create_ash_panel = true; 535 if (extension_id == id) {
544 break; 536 create_ash_panel = true;
537 break;
538 }
545 } 539 }
546 #endif // defined(USE_ASH) 540 #endif // defined(USE_ASH)
547 // Everything else gets POPUP instead of PANEL. 541 // Everything else gets POPUP instead of PANEL.
548 // TODO(dimich): Eventually, remove the 'panel' values form valid 542 // TODO(dimich): Eventually, remove the 'panel' values form valid
549 // window.create parameters. However, this is a more breaking change, so 543 // window.create parameters. However, this is a more breaking change, so
550 // for now simply treat it as a POPUP. 544 // for now simply treat it as a POPUP.
551 window_type = Browser::TYPE_POPUP; 545 window_type = Browser::TYPE_POPUP;
552 break; 546 break;
553 } 547 }
554 548
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 window_bounds.set_y(*create_data->top); 580 window_bounds.set_y(*create_data->top);
587 581
588 if (create_data->width) 582 if (create_data->width)
589 window_bounds.set_width(*create_data->width); 583 window_bounds.set_width(*create_data->width);
590 584
591 if (create_data->height) 585 if (create_data->height)
592 window_bounds.set_height(*create_data->height); 586 window_bounds.set_height(*create_data->height);
593 587
594 if (create_data->focused) { 588 if (create_data->focused) {
595 focused = *create_data->focused; 589 focused = *create_data->focused;
590 #if defined(USE_ASH)
596 saw_focus_key = true; 591 saw_focus_key = true;
592 #endif
597 } 593 }
598 } 594 }
599 595
600 #if defined(USE_ASH) 596 #if defined(USE_ASH)
601 if (create_ash_panel) { 597 if (create_ash_panel) {
602 if (urls.empty()) 598 if (urls.empty())
603 urls.push_back(GURL(chrome::kChromeUINewTabURL)); 599 urls.push_back(GURL(chrome::kChromeUINewTabURL));
604 600
605 AppWindow::CreateParams create_params; 601 AppWindow::CreateParams create_params;
606 create_params.window_type = AppWindow::WINDOW_TYPE_V1_PANEL; 602 create_params.window_type = AppWindow::WINDOW_TYPE_V1_PANEL;
(...skipping 1580 matching lines...) Expand 10 before | Expand all | Expand 10 after
2187 params->tab_id 2183 params->tab_id
2188 ? ErrorUtils::FormatErrorMessage(keys::kCannotDiscardTab, 2184 ? ErrorUtils::FormatErrorMessage(keys::kCannotDiscardTab,
2189 base::IntToString(*params->tab_id)) 2185 base::IntToString(*params->tab_id))
2190 : keys::kCannotFindTabToDiscard)); 2186 : keys::kCannotFindTabToDiscard));
2191 } 2187 }
2192 2188
2193 TabsDiscardFunction::TabsDiscardFunction() {} 2189 TabsDiscardFunction::TabsDiscardFunction() {}
2194 TabsDiscardFunction::~TabsDiscardFunction() {} 2190 TabsDiscardFunction::~TabsDiscardFunction() {}
2195 2191
2196 } // namespace extensions 2192 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698