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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 #include "ash/magnifier/magnifier_constants.h" | 146 #include "ash/magnifier/magnifier_constants.h" |
147 #include "ash/shell.h" | 147 #include "ash/shell.h" |
148 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 148 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
149 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 149 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
150 #include "chrome/browser/profiles/profile_manager.h" | 150 #include "chrome/browser/profiles/profile_manager.h" |
151 #include "chrome/browser/ui/ash/screenshot_taker.h" | 151 #include "chrome/browser/ui/ash/screenshot_taker.h" |
152 #include "chromeos/audio/cras_audio_handler.h" | 152 #include "chromeos/audio/cras_audio_handler.h" |
153 #endif | 153 #endif |
154 | 154 |
155 #if !defined(OS_MACOSX) | 155 #if !defined(OS_MACOSX) |
156 #include "apps/shell_window.h" | 156 #include "apps/app_window.h" |
157 #include "apps/shell_window_registry.h" | 157 #include "apps/app_window_registry.h" |
158 #include "apps/ui/native_app_window.h" | 158 #include "apps/ui/native_app_window.h" |
159 #include "base/basictypes.h" | 159 #include "base/basictypes.h" |
160 #include "base/compiler_specific.h" | 160 #include "base/compiler_specific.h" |
161 #include "chrome/browser/ui/extensions/application_launch.h" | 161 #include "chrome/browser/ui/extensions/application_launch.h" |
162 #include "ui/base/window_open_disposition.h" | 162 #include "ui/base/window_open_disposition.h" |
163 #endif | 163 #endif |
164 | 164 |
165 using content::BrowserThread; | 165 using content::BrowserThread; |
166 using content::URLRequestMockHTTPJob; | 166 using content::URLRequestMockHTTPJob; |
167 using testing::Mock; | 167 using testing::Mock; |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 message_loop_runner_->Quit(); | 527 message_loop_runner_->Quit(); |
528 } | 528 } |
529 | 529 |
530 void WebContentsLoadedOrDestroyedWatcher::DidStopLoading( | 530 void WebContentsLoadedOrDestroyedWatcher::DidStopLoading( |
531 content::RenderViewHost* render_view_host) { | 531 content::RenderViewHost* render_view_host) { |
532 message_loop_runner_->Quit(); | 532 message_loop_runner_->Quit(); |
533 } | 533 } |
534 | 534 |
535 #if !defined(OS_MACOSX) | 535 #if !defined(OS_MACOSX) |
536 | 536 |
537 // Observer used to wait for the creation of a new shell window. | 537 // Observer used to wait for the creation of a new app window. |
538 class TestAddShellWindowObserver : public apps::ShellWindowRegistry::Observer { | 538 class TestAddAppWindowObserver : public apps::AppWindowRegistry::Observer { |
539 public: | 539 public: |
540 explicit TestAddShellWindowObserver(apps::ShellWindowRegistry* registry); | 540 explicit TestAddAppWindowObserver(apps::AppWindowRegistry* registry); |
541 virtual ~TestAddShellWindowObserver(); | 541 virtual ~TestAddAppWindowObserver(); |
542 | 542 |
543 // apps::ShellWindowRegistry::Observer: | 543 // apps::AppWindowRegistry::Observer: |
544 virtual void OnShellWindowAdded(apps::ShellWindow* shell_window) OVERRIDE; | 544 virtual void OnAppWindowAdded(apps::AppWindow* app_window) OVERRIDE; |
545 virtual void OnShellWindowIconChanged( | 545 virtual void OnAppWindowIconChanged(apps::AppWindow* app_window) OVERRIDE; |
546 apps::ShellWindow* shell_window) OVERRIDE; | 546 virtual void OnAppWindowRemoved(apps::AppWindow* app_window) OVERRIDE; |
547 virtual void OnShellWindowRemoved(apps::ShellWindow* shell_window) OVERRIDE; | |
548 | 547 |
549 apps::ShellWindow* WaitForShellWindow(); | 548 apps::AppWindow* WaitForAppWindow(); |
550 | 549 |
551 private: | 550 private: |
552 apps::ShellWindowRegistry* registry_; // Not owned. | 551 apps::AppWindowRegistry* registry_; // Not owned. |
553 apps::ShellWindow* window_; // Not owned. | 552 apps::AppWindow* window_; // Not owned. |
554 base::RunLoop run_loop_; | 553 base::RunLoop run_loop_; |
555 | 554 |
556 DISALLOW_COPY_AND_ASSIGN(TestAddShellWindowObserver); | 555 DISALLOW_COPY_AND_ASSIGN(TestAddAppWindowObserver); |
557 }; | 556 }; |
558 | 557 |
559 TestAddShellWindowObserver::TestAddShellWindowObserver( | 558 TestAddAppWindowObserver::TestAddAppWindowObserver( |
560 apps::ShellWindowRegistry* registry) | 559 apps::AppWindowRegistry* registry) |
561 : registry_(registry), | 560 : registry_(registry), window_(NULL) { |
562 window_(NULL) { | |
563 registry_->AddObserver(this); | 561 registry_->AddObserver(this); |
564 } | 562 } |
565 | 563 |
566 TestAddShellWindowObserver::~TestAddShellWindowObserver() { | 564 TestAddAppWindowObserver::~TestAddAppWindowObserver() { |
567 registry_->RemoveObserver(this); | 565 registry_->RemoveObserver(this); |
568 } | 566 } |
569 | 567 |
570 void TestAddShellWindowObserver::OnShellWindowAdded( | 568 void TestAddAppWindowObserver::OnAppWindowAdded(apps::AppWindow* app_window) { |
571 apps::ShellWindow* shell_window) { | 569 window_ = app_window; |
572 window_ = shell_window; | |
573 run_loop_.Quit(); | 570 run_loop_.Quit(); |
574 } | 571 } |
575 | 572 |
576 void TestAddShellWindowObserver::OnShellWindowIconChanged( | 573 void TestAddAppWindowObserver::OnAppWindowIconChanged( |
577 apps::ShellWindow* shell_window) { | 574 apps::AppWindow* app_window) {} |
| 575 |
| 576 void TestAddAppWindowObserver::OnAppWindowRemoved(apps::AppWindow* app_window) { |
578 } | 577 } |
579 | 578 |
580 void TestAddShellWindowObserver::OnShellWindowRemoved( | 579 apps::AppWindow* TestAddAppWindowObserver::WaitForAppWindow() { |
581 apps::ShellWindow* shell_window) { | |
582 } | |
583 | |
584 apps::ShellWindow* TestAddShellWindowObserver::WaitForShellWindow() { | |
585 run_loop_.Run(); | 580 run_loop_.Run(); |
586 return window_; | 581 return window_; |
587 } | 582 } |
588 | 583 |
589 #endif | 584 #endif |
590 | 585 |
591 } // namespace | 586 } // namespace |
592 | 587 |
593 class PolicyTest : public InProcessBrowserTest { | 588 class PolicyTest : public InProcessBrowserTest { |
594 protected: | 589 protected: |
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2088 policies.Set(key::kFullscreenAllowed, | 2083 policies.Set(key::kFullscreenAllowed, |
2089 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 2084 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
2090 base::Value::CreateBooleanValue(false), NULL); | 2085 base::Value::CreateBooleanValue(false), NULL); |
2091 UpdateProviderPolicy(policies); | 2086 UpdateProviderPolicy(policies); |
2092 | 2087 |
2093 const extensions::Extension* extension = | 2088 const extensions::Extension* extension = |
2094 LoadUnpackedExtension(kUnpackedFullscreenAppName, true); | 2089 LoadUnpackedExtension(kUnpackedFullscreenAppName, true); |
2095 ASSERT_TRUE(extension); | 2090 ASSERT_TRUE(extension); |
2096 | 2091 |
2097 // Launch an app that tries to open a fullscreen window. | 2092 // Launch an app that tries to open a fullscreen window. |
2098 TestAddShellWindowObserver add_window_observer( | 2093 TestAddAppWindowObserver add_window_observer( |
2099 apps::ShellWindowRegistry::Get(browser()->profile())); | 2094 apps::AppWindowRegistry::Get(browser()->profile())); |
2100 OpenApplication(AppLaunchParams(browser()->profile(), | 2095 OpenApplication(AppLaunchParams(browser()->profile(), |
2101 extension, | 2096 extension, |
2102 extensions::LAUNCH_CONTAINER_NONE, | 2097 extensions::LAUNCH_CONTAINER_NONE, |
2103 NEW_WINDOW)); | 2098 NEW_WINDOW)); |
2104 apps::ShellWindow* window = add_window_observer.WaitForShellWindow(); | 2099 apps::AppWindow* window = add_window_observer.WaitForAppWindow(); |
2105 ASSERT_TRUE(window); | 2100 ASSERT_TRUE(window); |
2106 | 2101 |
2107 // Verify that the window is not in fullscreen mode. | 2102 // Verify that the window is not in fullscreen mode. |
2108 EXPECT_FALSE(window->GetBaseWindow()->IsFullscreen()); | 2103 EXPECT_FALSE(window->GetBaseWindow()->IsFullscreen()); |
2109 | 2104 |
2110 // Verify that the window cannot be toggled into fullscreen mode via apps | 2105 // Verify that the window cannot be toggled into fullscreen mode via apps |
2111 // APIs. | 2106 // APIs. |
2112 EXPECT_TRUE(content::ExecuteScript( | 2107 EXPECT_TRUE(content::ExecuteScript( |
2113 window->web_contents(), | 2108 window->web_contents(), |
2114 "chrome.app.window.current().fullscreen();")); | 2109 "chrome.app.window.current().fullscreen();")); |
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2981 PrefService* prefs = browser()->profile()->GetPrefs(); | 2976 PrefService* prefs = browser()->profile()->GetPrefs(); |
2982 EXPECT_TRUE(extensions::NativeMessageProcessHost::IsHostAllowed( | 2977 EXPECT_TRUE(extensions::NativeMessageProcessHost::IsHostAllowed( |
2983 prefs, "host.name")); | 2978 prefs, "host.name")); |
2984 EXPECT_FALSE(extensions::NativeMessageProcessHost::IsHostAllowed( | 2979 EXPECT_FALSE(extensions::NativeMessageProcessHost::IsHostAllowed( |
2985 prefs, "other.host.name")); | 2980 prefs, "other.host.name")); |
2986 } | 2981 } |
2987 | 2982 |
2988 #endif // !defined(CHROME_OS) | 2983 #endif // !defined(CHROME_OS) |
2989 | 2984 |
2990 } // namespace policy | 2985 } // namespace policy |
OLD | NEW |