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

Side by Side Diff: chrome/browser/extensions/extension_tabs_module.cc

Issue 9717011: Expose the chrome.windows.* API to platform apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable WindowsApi on Aura.x Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/platform_app_browsertest.cc » ('j') | 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/extension_tabs_module.h" 5 #include "chrome/browser/extensions/extension_tabs_module.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 17 matching lines...) Expand all
28 #include "chrome/browser/extensions/extension_window_list.h" 28 #include "chrome/browser/extensions/extension_window_list.h"
29 #include "chrome/browser/prefs/incognito_mode_prefs.h" 29 #include "chrome/browser/prefs/incognito_mode_prefs.h"
30 #include "chrome/browser/profiles/profile.h" 30 #include "chrome/browser/profiles/profile.h"
31 #include "chrome/browser/sessions/restore_tab_helper.h" 31 #include "chrome/browser/sessions/restore_tab_helper.h"
32 #include "chrome/browser/tabs/tab_strip_model.h" 32 #include "chrome/browser/tabs/tab_strip_model.h"
33 #include "chrome/browser/translate/translate_tab_helper.h" 33 #include "chrome/browser/translate/translate_tab_helper.h"
34 #include "chrome/browser/ui/browser.h" 34 #include "chrome/browser/ui/browser.h"
35 #include "chrome/browser/ui/browser_list.h" 35 #include "chrome/browser/ui/browser_list.h"
36 #include "chrome/browser/ui/browser_navigator.h" 36 #include "chrome/browser/ui/browser_navigator.h"
37 #include "chrome/browser/ui/browser_window.h" 37 #include "chrome/browser/ui/browser_window.h"
38 #include "chrome/browser/ui/extensions/shell_window.h"
38 #include "chrome/browser/ui/panels/panel_manager.h" 39 #include "chrome/browser/ui/panels/panel_manager.h"
39 #include "chrome/browser/ui/snapshot_tab_helper.h" 40 #include "chrome/browser/ui/snapshot_tab_helper.h"
40 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 41 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
41 #include "chrome/browser/ui/window_sizer.h" 42 #include "chrome/browser/ui/window_sizer.h"
42 #include "chrome/browser/web_applications/web_app.h" 43 #include "chrome/browser/web_applications/web_app.h"
43 #include "chrome/common/chrome_notification_types.h" 44 #include "chrome/common/chrome_notification_types.h"
44 #include "chrome/common/chrome_switches.h" 45 #include "chrome/common/chrome_switches.h"
45 #include "chrome/common/extensions/api/windows.h" 46 #include "chrome/common/extensions/api/windows.h"
46 #include "chrome/common/extensions/extension.h" 47 #include "chrome/common/extensions/extension.h"
47 #include "chrome/common/extensions/extension_error_utils.h" 48 #include "chrome/common/extensions/extension_error_utils.h"
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 #endif 554 #endif
554 #if defined(USE_ASH) 555 #if defined(USE_ASH)
555 if (CommandLine::ForCurrentProcess()->HasSwitch( 556 if (CommandLine::ForCurrentProcess()->HasSwitch(
556 ash::switches::kAuraPanelManager)) 557 ash::switches::kAuraPanelManager))
557 use_panels = true; 558 use_panels = true;
558 #endif 559 #endif
559 if (use_panels) 560 if (use_panels)
560 window_type = Browser::TYPE_PANEL; 561 window_type = Browser::TYPE_PANEL;
561 else 562 else
562 window_type = Browser::TYPE_POPUP; 563 window_type = Browser::TYPE_POPUP;
564 } else if (type_str == keys::kWindowTypeValueShell &&
565 GetExtension()->is_platform_app()) {
566 GURL window_url =
567 urls.empty() ? GetExtension()->GetFullLaunchURL() : urls[0];
568 ShellWindow* shell_window =
569 ShellWindow::Create(window_profile, GetExtension(), window_url);
570 result_.reset(shell_window->extension_window_controller()->
571 CreateWindowValueWithTabs());
572 return true;
563 } else if (type_str != keys::kWindowTypeValueNormal) { 573 } else if (type_str != keys::kWindowTypeValueNormal) {
564 error_ = keys::kInvalidWindowTypeError; 574 error_ = keys::kInvalidWindowTypeError;
565 return false; 575 return false;
566 } 576 }
567 } 577 }
568 } 578 }
569 579
570 #if defined(USE_ASH) 580 #if defined(USE_ASH)
571 // Aura Panels create a new PanelViewAura. 581 // Aura Panels create a new PanelViewAura.
572 if (CommandLine::ForCurrentProcess()->HasSwitch( 582 if (CommandLine::ForCurrentProcess()->HasSwitch(
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1807 // called for every API call the extension made. 1817 // called for every API call the extension made.
1808 GotLanguage(language); 1818 GotLanguage(language);
1809 } 1819 }
1810 1820
1811 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { 1821 void DetectTabLanguageFunction::GotLanguage(const std::string& language) {
1812 result_.reset(Value::CreateStringValue(language.c_str())); 1822 result_.reset(Value::CreateStringValue(language.c_str()));
1813 SendResponse(true); 1823 SendResponse(true);
1814 1824
1815 Release(); // Balanced in Run() 1825 Release(); // Balanced in Run()
1816 } 1826 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/platform_app_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698