| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 #include "ash/shell.h" | 151 #include "ash/shell.h" |
| 152 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 152 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 153 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 153 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
| 154 #include "chrome/browser/profiles/profile_manager.h" | 154 #include "chrome/browser/profiles/profile_manager.h" |
| 155 #include "chrome/browser/ui/ash/screenshot_taker.h" | 155 #include "chrome/browser/ui/ash/screenshot_taker.h" |
| 156 #include "chromeos/audio/cras_audio_handler.h" | 156 #include "chromeos/audio/cras_audio_handler.h" |
| 157 #include "ui/keyboard/keyboard_util.h" | 157 #include "ui/keyboard/keyboard_util.h" |
| 158 #endif | 158 #endif |
| 159 | 159 |
| 160 #if !defined(OS_MACOSX) | 160 #if !defined(OS_MACOSX) |
| 161 #include "apps/app_window.h" | |
| 162 #include "apps/app_window_registry.h" | |
| 163 #include "base/basictypes.h" | 161 #include "base/basictypes.h" |
| 164 #include "base/compiler_specific.h" | 162 #include "base/compiler_specific.h" |
| 165 #include "chrome/browser/ui/extensions/application_launch.h" | 163 #include "chrome/browser/ui/extensions/application_launch.h" |
| 164 #include "extensions/browser/app_window/app_window.h" |
| 165 #include "extensions/browser/app_window/app_window_registry.h" |
| 166 #include "extensions/browser/app_window/native_app_window.h" | 166 #include "extensions/browser/app_window/native_app_window.h" |
| 167 #include "ui/base/window_open_disposition.h" | 167 #include "ui/base/window_open_disposition.h" |
| 168 #endif | 168 #endif |
| 169 | 169 |
| 170 using content::BrowserThread; | 170 using content::BrowserThread; |
| 171 using content::URLRequestMockHTTPJob; | 171 using content::URLRequestMockHTTPJob; |
| 172 using testing::Mock; | 172 using testing::Mock; |
| 173 using testing::Return; | 173 using testing::Return; |
| 174 using testing::_; | 174 using testing::_; |
| 175 | 175 |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 } | 533 } |
| 534 | 534 |
| 535 void WebContentsLoadedOrDestroyedWatcher::DidStopLoading( | 535 void WebContentsLoadedOrDestroyedWatcher::DidStopLoading( |
| 536 content::RenderViewHost* render_view_host) { | 536 content::RenderViewHost* render_view_host) { |
| 537 message_loop_runner_->Quit(); | 537 message_loop_runner_->Quit(); |
| 538 } | 538 } |
| 539 | 539 |
| 540 #if !defined(OS_MACOSX) | 540 #if !defined(OS_MACOSX) |
| 541 | 541 |
| 542 // Observer used to wait for the creation of a new app window. | 542 // Observer used to wait for the creation of a new app window. |
| 543 class TestAddAppWindowObserver : public apps::AppWindowRegistry::Observer { | 543 class TestAddAppWindowObserver |
| 544 : public extensions::AppWindowRegistry::Observer { |
| 544 public: | 545 public: |
| 545 explicit TestAddAppWindowObserver(apps::AppWindowRegistry* registry); | 546 explicit TestAddAppWindowObserver(extensions::AppWindowRegistry* registry); |
| 546 virtual ~TestAddAppWindowObserver(); | 547 virtual ~TestAddAppWindowObserver(); |
| 547 | 548 |
| 548 // apps::AppWindowRegistry::Observer: | 549 // extensions::AppWindowRegistry::Observer: |
| 549 virtual void OnAppWindowAdded(apps::AppWindow* app_window) OVERRIDE; | 550 virtual void OnAppWindowAdded(extensions::AppWindow* app_window) OVERRIDE; |
| 550 | 551 |
| 551 apps::AppWindow* WaitForAppWindow(); | 552 extensions::AppWindow* WaitForAppWindow(); |
| 552 | 553 |
| 553 private: | 554 private: |
| 554 apps::AppWindowRegistry* registry_; // Not owned. | 555 extensions::AppWindowRegistry* registry_; // Not owned. |
| 555 apps::AppWindow* window_; // Not owned. | 556 extensions::AppWindow* window_; // Not owned. |
| 556 base::RunLoop run_loop_; | 557 base::RunLoop run_loop_; |
| 557 | 558 |
| 558 DISALLOW_COPY_AND_ASSIGN(TestAddAppWindowObserver); | 559 DISALLOW_COPY_AND_ASSIGN(TestAddAppWindowObserver); |
| 559 }; | 560 }; |
| 560 | 561 |
| 561 TestAddAppWindowObserver::TestAddAppWindowObserver( | 562 TestAddAppWindowObserver::TestAddAppWindowObserver( |
| 562 apps::AppWindowRegistry* registry) | 563 extensions::AppWindowRegistry* registry) |
| 563 : registry_(registry), window_(NULL) { | 564 : registry_(registry), window_(NULL) { |
| 564 registry_->AddObserver(this); | 565 registry_->AddObserver(this); |
| 565 } | 566 } |
| 566 | 567 |
| 567 TestAddAppWindowObserver::~TestAddAppWindowObserver() { | 568 TestAddAppWindowObserver::~TestAddAppWindowObserver() { |
| 568 registry_->RemoveObserver(this); | 569 registry_->RemoveObserver(this); |
| 569 } | 570 } |
| 570 | 571 |
| 571 void TestAddAppWindowObserver::OnAppWindowAdded(apps::AppWindow* app_window) { | 572 void TestAddAppWindowObserver::OnAppWindowAdded( |
| 573 extensions::AppWindow* app_window) { |
| 572 window_ = app_window; | 574 window_ = app_window; |
| 573 run_loop_.Quit(); | 575 run_loop_.Quit(); |
| 574 } | 576 } |
| 575 | 577 |
| 576 apps::AppWindow* TestAddAppWindowObserver::WaitForAppWindow() { | 578 extensions::AppWindow* TestAddAppWindowObserver::WaitForAppWindow() { |
| 577 run_loop_.Run(); | 579 run_loop_.Run(); |
| 578 return window_; | 580 return window_; |
| 579 } | 581 } |
| 580 | 582 |
| 581 #endif | 583 #endif |
| 582 | 584 |
| 583 } // namespace | 585 } // namespace |
| 584 | 586 |
| 585 class PolicyTest : public InProcessBrowserTest { | 587 class PolicyTest : public InProcessBrowserTest { |
| 586 protected: | 588 protected: |
| (...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2215 new base::FundamentalValue(false), | 2217 new base::FundamentalValue(false), |
| 2216 NULL); | 2218 NULL); |
| 2217 UpdateProviderPolicy(policies); | 2219 UpdateProviderPolicy(policies); |
| 2218 | 2220 |
| 2219 const extensions::Extension* extension = | 2221 const extensions::Extension* extension = |
| 2220 LoadUnpackedExtension(kUnpackedFullscreenAppName, true); | 2222 LoadUnpackedExtension(kUnpackedFullscreenAppName, true); |
| 2221 ASSERT_TRUE(extension); | 2223 ASSERT_TRUE(extension); |
| 2222 | 2224 |
| 2223 // Launch an app that tries to open a fullscreen window. | 2225 // Launch an app that tries to open a fullscreen window. |
| 2224 TestAddAppWindowObserver add_window_observer( | 2226 TestAddAppWindowObserver add_window_observer( |
| 2225 apps::AppWindowRegistry::Get(browser()->profile())); | 2227 extensions::AppWindowRegistry::Get(browser()->profile())); |
| 2226 OpenApplication(AppLaunchParams(browser()->profile(), | 2228 OpenApplication(AppLaunchParams(browser()->profile(), |
| 2227 extension, | 2229 extension, |
| 2228 extensions::LAUNCH_CONTAINER_NONE, | 2230 extensions::LAUNCH_CONTAINER_NONE, |
| 2229 NEW_WINDOW)); | 2231 NEW_WINDOW)); |
| 2230 apps::AppWindow* window = add_window_observer.WaitForAppWindow(); | 2232 extensions::AppWindow* window = add_window_observer.WaitForAppWindow(); |
| 2231 ASSERT_TRUE(window); | 2233 ASSERT_TRUE(window); |
| 2232 | 2234 |
| 2233 // Verify that the window is not in fullscreen mode. | 2235 // Verify that the window is not in fullscreen mode. |
| 2234 EXPECT_FALSE(window->GetBaseWindow()->IsFullscreen()); | 2236 EXPECT_FALSE(window->GetBaseWindow()->IsFullscreen()); |
| 2235 | 2237 |
| 2236 // Verify that the window cannot be toggled into fullscreen mode via apps | 2238 // Verify that the window cannot be toggled into fullscreen mode via apps |
| 2237 // APIs. | 2239 // APIs. |
| 2238 EXPECT_TRUE(content::ExecuteScript( | 2240 EXPECT_TRUE(content::ExecuteScript( |
| 2239 window->web_contents(), | 2241 window->web_contents(), |
| 2240 "chrome.app.window.current().fullscreen();")); | 2242 "chrome.app.window.current().fullscreen();")); |
| (...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3210 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 3212 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
| 3211 browser2->tab_strip_model()->GetActiveWebContents(), | 3213 browser2->tab_strip_model()->GetActiveWebContents(), |
| 3212 "domAutomationController.send(window.showModalDialog !== undefined);", | 3214 "domAutomationController.send(window.showModalDialog !== undefined);", |
| 3213 &result)); | 3215 &result)); |
| 3214 EXPECT_TRUE(result); | 3216 EXPECT_TRUE(result); |
| 3215 } | 3217 } |
| 3216 | 3218 |
| 3217 #endif // !defined(CHROME_OS) | 3219 #endif // !defined(CHROME_OS) |
| 3218 | 3220 |
| 3219 } // namespace policy | 3221 } // namespace policy |
| OLD | NEW |