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

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

Issue 58873002: Adjusts panel ifdefs for aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: integrate feedback Created 7 years, 1 month 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 | Annotate | Revision Log
« 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 <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 break; 457 break;
458 case windows::Create::Params::CreateData::TYPE_PANEL: 458 case windows::Create::Params::CreateData::TYPE_PANEL:
459 case windows::Create::Params::CreateData::TYPE_DETACHED_PANEL: { 459 case windows::Create::Params::CreateData::TYPE_DETACHED_PANEL: {
460 extension_id = GetExtension()->id(); 460 extension_id = GetExtension()->id();
461 bool use_panels = false; 461 bool use_panels = false;
462 #if !defined(OS_ANDROID) 462 #if !defined(OS_ANDROID)
463 use_panels = PanelManager::ShouldUsePanels(extension_id); 463 use_panels = PanelManager::ShouldUsePanels(extension_id);
464 #endif 464 #endif
465 if (use_panels) { 465 if (use_panels) {
466 create_panel = true; 466 create_panel = true;
467 #if !defined(OS_CHROMEOS) 467 // Non-ash supports both docked and detached panel types.
468 // Non-ChromeOS has both docked and detached panel types. 468 if (chrome::GetActiveDesktop() != chrome::HOST_DESKTOP_TYPE_ASH &&
469 if (create_data->type == 469 create_data->type ==
470 windows::Create::Params::CreateData::TYPE_DETACHED_PANEL) { 470 windows::Create::Params::CreateData::TYPE_DETACHED_PANEL) {
471 panel_create_mode = PanelManager::CREATE_AS_DETACHED; 471 panel_create_mode = PanelManager::CREATE_AS_DETACHED;
472 } 472 }
473 #endif
474 } else { 473 } else {
475 window_type = Browser::TYPE_POPUP; 474 window_type = Browser::TYPE_POPUP;
476 } 475 }
477 break; 476 break;
478 } 477 }
479 case windows::Create::Params::CreateData::TYPE_NONE: 478 case windows::Create::Params::CreateData::TYPE_NONE:
480 case windows::Create::Params::CreateData::TYPE_NORMAL: 479 case windows::Create::Params::CreateData::TYPE_NORMAL:
481 break; 480 break;
482 default: 481 default:
483 error_ = keys::kInvalidWindowTypeError; 482 error_ = keys::kInvalidWindowTypeError;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 if (create_data->focused) { 523 if (create_data->focused) {
525 focused = *create_data->focused; 524 focused = *create_data->focused;
526 saw_focus_key = true; 525 saw_focus_key = true;
527 } 526 }
528 } 527 }
529 528
530 if (create_panel) { 529 if (create_panel) {
531 if (urls.empty()) 530 if (urls.empty())
532 urls.push_back(GURL(chrome::kChromeUINewTabURL)); 531 urls.push_back(GURL(chrome::kChromeUINewTabURL));
533 532
534 #if defined(OS_CHROMEOS) 533 if (PanelManager::ShouldUsePanels(extension_id) &&
Dmitry Titov 2013/11/05 17:47:19 This check for ShouldUsePanels can be removed sinc
sky 2013/11/05 18:07:54 Done.
535 if (PanelManager::ShouldUsePanels(extension_id)) { 534 chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) {
536 ShellWindow::CreateParams create_params; 535 ShellWindow::CreateParams create_params;
537 create_params.window_type = ShellWindow::WINDOW_TYPE_V1_PANEL; 536 create_params.window_type = ShellWindow::WINDOW_TYPE_V1_PANEL;
538 create_params.bounds = window_bounds; 537 create_params.bounds = window_bounds;
539 create_params.focused = saw_focus_key && focused; 538 create_params.focused = saw_focus_key && focused;
540 ShellWindow* shell_window = new ShellWindow( 539 ShellWindow* shell_window = new ShellWindow(
541 window_profile, new ChromeShellWindowDelegate(), 540 window_profile, new ChromeShellWindowDelegate(),
542 GetExtension()); 541 GetExtension());
543 AshPanelContents* ash_panel_contents = new AshPanelContents(shell_window); 542 AshPanelContents* ash_panel_contents = new AshPanelContents(shell_window);
544 shell_window->Init(urls[0], ash_panel_contents, create_params); 543 shell_window->Init(urls[0], ash_panel_contents, create_params);
545 SetResult(ash_panel_contents->GetExtensionWindowController()-> 544 SetResult(ash_panel_contents->GetExtensionWindowController()->
546 CreateWindowValueWithTabs(GetExtension())); 545 CreateWindowValueWithTabs(GetExtension()));
547 return true; 546 return true;
548 } 547 }
549 #else
550 std::string title = 548 std::string title =
551 web_app::GenerateApplicationNameFromExtensionId(extension_id); 549 web_app::GenerateApplicationNameFromExtensionId(extension_id);
552 // Note: Panels ignore all but the first url provided. 550 // Note: Panels ignore all but the first url provided.
553 Panel* panel = PanelManager::GetInstance()->CreatePanel( 551 Panel* panel = PanelManager::GetInstance()->CreatePanel(
554 title, window_profile, urls[0], window_bounds, panel_create_mode); 552 title, window_profile, urls[0], window_bounds, panel_create_mode);
555 553
556 // Unlike other window types, Panels do not take focus by default. 554 // Unlike other window types, Panels do not take focus by default.
557 if (!saw_focus_key || !focused) 555 if (!saw_focus_key || !focused)
558 panel->ShowInactive(); 556 panel->ShowInactive();
559 else 557 else
560 panel->Show(); 558 panel->Show();
561 559
562 SetResult( 560 SetResult(
563 panel->extension_window_controller()->CreateWindowValueWithTabs( 561 panel->extension_window_controller()->CreateWindowValueWithTabs(
564 GetExtension())); 562 GetExtension()));
565 return true; 563 return true;
566 #endif
567 } 564 }
568 565
569 // Create a new BrowserWindow. 566 // Create a new BrowserWindow.
570 chrome::HostDesktopType host_desktop_type = chrome::GetActiveDesktop(); 567 chrome::HostDesktopType host_desktop_type = chrome::GetActiveDesktop();
571 if (create_panel) 568 if (create_panel)
572 window_type = Browser::TYPE_POPUP; 569 window_type = Browser::TYPE_POPUP;
573 Browser::CreateParams create_params(window_type, window_profile, 570 Browser::CreateParams create_params(window_type, window_profile,
574 host_desktop_type); 571 host_desktop_type);
575 if (extension_id.empty()) { 572 if (extension_id.empty()) {
576 create_params.initial_bounds = window_bounds; 573 create_params.initial_bounds = window_bounds;
(...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after
2065 execute_tab_id_ = tab_id; 2062 execute_tab_id_ = tab_id;
2066 details_ = details.Pass(); 2063 details_ = details.Pass();
2067 return true; 2064 return true;
2068 } 2065 }
2069 2066
2070 bool TabsInsertCSSFunction::ShouldInsertCSS() const { 2067 bool TabsInsertCSSFunction::ShouldInsertCSS() const {
2071 return true; 2068 return true;
2072 } 2069 }
2073 2070
2074 } // namespace extensions 2071 } // 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