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

Side by Side Diff: chrome/browser/policy/policy_browsertest.cc

Issue 706013004: Move non-browser specific ScreenshotTaker code to ui/snapshot. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix missing comma. Created 6 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
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 <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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 #include "ui/base/resource/resource_bundle.h" 155 #include "ui/base/resource/resource_bundle.h"
156 #include "url/gurl.h" 156 #include "url/gurl.h"
157 157
158 #if defined(OS_CHROMEOS) 158 #if defined(OS_CHROMEOS)
159 #include "ash/accelerators/accelerator_controller.h" 159 #include "ash/accelerators/accelerator_controller.h"
160 #include "ash/accelerators/accelerator_table.h" 160 #include "ash/accelerators/accelerator_table.h"
161 #include "ash/shell.h" 161 #include "ash/shell.h"
162 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 162 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
163 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" 163 #include "chrome/browser/chromeos/accessibility/magnification_manager.h"
164 #include "chrome/browser/profiles/profile_manager.h" 164 #include "chrome/browser/profiles/profile_manager.h"
165 #include "chrome/browser/ui/ash/screenshot_taker.h" 165 #include "chrome/browser/ui/ash/chrome_screenshot_taker.h"
166 #include "chromeos/audio/cras_audio_handler.h" 166 #include "chromeos/audio/cras_audio_handler.h"
167 #include "ui/chromeos/accessibility_types.h" 167 #include "ui/chromeos/accessibility_types.h"
168 #include "ui/keyboard/keyboard_util.h" 168 #include "ui/keyboard/keyboard_util.h"
169 #include "ui/snapshot/screenshot_taker.h"
169 #endif 170 #endif
170 171
171 #if !defined(OS_MACOSX) 172 #if !defined(OS_MACOSX)
172 #include "base/basictypes.h" 173 #include "base/basictypes.h"
173 #include "base/compiler_specific.h" 174 #include "base/compiler_specific.h"
174 #include "chrome/browser/ui/extensions/application_launch.h" 175 #include "chrome/browser/ui/extensions/application_launch.h"
175 #include "extensions/browser/app_window/app_window.h" 176 #include "extensions/browser/app_window/app_window.h"
176 #include "extensions/browser/app_window/app_window_registry.h" 177 #include "extensions/browser/app_window/app_window_registry.h"
177 #include "extensions/browser/app_window/native_app_window.h" 178 #include "extensions/browser/app_window/native_app_window.h"
178 #include "ui/base/window_open_disposition.h" 179 #include "ui/base/window_open_disposition.h"
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 PolicyMap policies; 646 PolicyMap policies;
646 policies.Set(key::kDisableScreenshots, 647 policies.Set(key::kDisableScreenshots,
647 POLICY_LEVEL_MANDATORY, 648 POLICY_LEVEL_MANDATORY,
648 POLICY_SCOPE_USER, 649 POLICY_SCOPE_USER,
649 new base::FundamentalValue(!enabled), 650 new base::FundamentalValue(!enabled),
650 NULL); 651 NULL);
651 UpdateProviderPolicy(policies); 652 UpdateProviderPolicy(policies);
652 } 653 }
653 654
654 #if defined(OS_CHROMEOS) 655 #if defined(OS_CHROMEOS)
655 class QuitMessageLoopAfterScreenshot : public ScreenshotTakerObserver { 656 class QuitMessageLoopAfterScreenshot : public ui::ScreenshotTakerObserver {
656 public: 657 public:
657 virtual void OnScreenshotCompleted( 658 virtual void OnScreenshotCompleted(
658 ScreenshotTakerObserver::Result screenshot_result, 659 ScreenshotTakerObserver::Result screenshot_result,
659 const base::FilePath& screenshot_path) override { 660 const base::FilePath& screenshot_path) override {
660 BrowserThread::PostTaskAndReply(BrowserThread::IO, 661 BrowserThread::PostTaskAndReply(BrowserThread::IO,
661 FROM_HERE, 662 FROM_HERE,
662 base::Bind(base::DoNothing), 663 base::Bind(base::DoNothing),
663 base::MessageLoop::QuitClosure()); 664 base::MessageLoop::QuitClosure());
664 } 665 }
665 666
666 virtual ~QuitMessageLoopAfterScreenshot() {} 667 virtual ~QuitMessageLoopAfterScreenshot() {}
667 }; 668 };
668 669
669 void TestScreenshotFile(bool enabled) { 670 void TestScreenshotFile(bool enabled) {
670 // AddObserver is an ash-specific method, so just replace the screenshot 671 // AddObserver is an ash-specific method, so just replace the screenshot
671 // taker with one we've created here. 672 // taker with one we've created here.
672 scoped_ptr<ScreenshotTaker> screenshot_taker(new ScreenshotTaker); 673 scoped_ptr<ChromeScreenshotTaker> chrome_screenshot_taker(
674 new ChromeScreenshotTaker);
673 // ScreenshotTaker doesn't own this observer, so the observer's lifetime 675 // ScreenshotTaker doesn't own this observer, so the observer's lifetime
674 // is tied to the test instead. 676 // is tied to the test instead.
675 screenshot_taker->AddObserver(&observer_); 677 chrome_screenshot_taker->screenshot_taker()->AddObserver(&observer_);
sky 2014/11/20 15:03:58 RemoveObserver?
flackr 2014/11/26 18:05:08 Done.
676 ash::Shell::GetInstance()->accelerator_controller()->SetScreenshotDelegate( 678 ash::Shell::GetInstance()->accelerator_controller()->SetScreenshotDelegate(
677 screenshot_taker.Pass()); 679 chrome_screenshot_taker.Pass());
678 680
679 SetScreenshotPolicy(enabled); 681 SetScreenshotPolicy(enabled);
680 ash::Shell::GetInstance()->accelerator_controller()->PerformAction( 682 ash::Shell::GetInstance()->accelerator_controller()->PerformAction(
681 ash::TAKE_SCREENSHOT, ui::Accelerator()); 683 ash::TAKE_SCREENSHOT, ui::Accelerator());
682 684
683 content::RunMessageLoop(); 685 content::RunMessageLoop();
684 } 686 }
685 #endif 687 #endif
686 688
687 ExtensionService* extension_service() { 689 ExtensionService* extension_service() {
(...skipping 2739 matching lines...) Expand 10 before | Expand all | Expand 10 after
3427 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( 3429 EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
3428 browser2->tab_strip_model()->GetActiveWebContents(), 3430 browser2->tab_strip_model()->GetActiveWebContents(),
3429 "domAutomationController.send(window.showModalDialog !== undefined);", 3431 "domAutomationController.send(window.showModalDialog !== undefined);",
3430 &result)); 3432 &result));
3431 EXPECT_TRUE(result); 3433 EXPECT_TRUE(result);
3432 } 3434 }
3433 3435
3434 #endif // !defined(CHROME_OS) 3436 #endif // !defined(CHROME_OS)
3435 3437
3436 } // namespace policy 3438 } // namespace policy
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/ash/ash_init.cc » ('j') | chrome/browser/ui/ash/chrome_screenshot_taker.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698