| 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 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 public: | 518 public: |
| 519 explicit WebContentsLoadedOrDestroyedWatcher( | 519 explicit WebContentsLoadedOrDestroyedWatcher( |
| 520 content::WebContents* web_contents); | 520 content::WebContents* web_contents); |
| 521 ~WebContentsLoadedOrDestroyedWatcher() override; | 521 ~WebContentsLoadedOrDestroyedWatcher() override; |
| 522 | 522 |
| 523 // Waits until the WebContents's load is done or until it is destroyed. | 523 // Waits until the WebContents's load is done or until it is destroyed. |
| 524 void Wait(); | 524 void Wait(); |
| 525 | 525 |
| 526 // Overridden WebContentsObserver methods. | 526 // Overridden WebContentsObserver methods. |
| 527 void WebContentsDestroyed() override; | 527 void WebContentsDestroyed() override; |
| 528 void DidStopLoading(content::RenderViewHost* render_view_host) override; | 528 void DidStopLoading() override; |
| 529 | 529 |
| 530 private: | 530 private: |
| 531 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; | 531 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; |
| 532 | 532 |
| 533 DISALLOW_COPY_AND_ASSIGN(WebContentsLoadedOrDestroyedWatcher); | 533 DISALLOW_COPY_AND_ASSIGN(WebContentsLoadedOrDestroyedWatcher); |
| 534 }; | 534 }; |
| 535 | 535 |
| 536 WebContentsLoadedOrDestroyedWatcher::WebContentsLoadedOrDestroyedWatcher( | 536 WebContentsLoadedOrDestroyedWatcher::WebContentsLoadedOrDestroyedWatcher( |
| 537 content::WebContents* web_contents) | 537 content::WebContents* web_contents) |
| 538 : content::WebContentsObserver(web_contents), | 538 : content::WebContentsObserver(web_contents), |
| 539 message_loop_runner_(new content::MessageLoopRunner) { | 539 message_loop_runner_(new content::MessageLoopRunner) { |
| 540 } | 540 } |
| 541 | 541 |
| 542 WebContentsLoadedOrDestroyedWatcher::~WebContentsLoadedOrDestroyedWatcher() {} | 542 WebContentsLoadedOrDestroyedWatcher::~WebContentsLoadedOrDestroyedWatcher() {} |
| 543 | 543 |
| 544 void WebContentsLoadedOrDestroyedWatcher::Wait() { | 544 void WebContentsLoadedOrDestroyedWatcher::Wait() { |
| 545 message_loop_runner_->Run(); | 545 message_loop_runner_->Run(); |
| 546 } | 546 } |
| 547 | 547 |
| 548 void WebContentsLoadedOrDestroyedWatcher::WebContentsDestroyed() { | 548 void WebContentsLoadedOrDestroyedWatcher::WebContentsDestroyed() { |
| 549 message_loop_runner_->Quit(); | 549 message_loop_runner_->Quit(); |
| 550 } | 550 } |
| 551 | 551 |
| 552 void WebContentsLoadedOrDestroyedWatcher::DidStopLoading( | 552 void WebContentsLoadedOrDestroyedWatcher::DidStopLoading() { |
| 553 content::RenderViewHost* render_view_host) { | |
| 554 message_loop_runner_->Quit(); | 553 message_loop_runner_->Quit(); |
| 555 } | 554 } |
| 556 | 555 |
| 557 #if !defined(OS_MACOSX) | 556 #if !defined(OS_MACOSX) |
| 558 | 557 |
| 559 // Observer used to wait for the creation of a new app window. | 558 // Observer used to wait for the creation of a new app window. |
| 560 class TestAddAppWindowObserver | 559 class TestAddAppWindowObserver |
| 561 : public extensions::AppWindowRegistry::Observer { | 560 : public extensions::AppWindowRegistry::Observer { |
| 562 public: | 561 public: |
| 563 explicit TestAddAppWindowObserver(extensions::AppWindowRegistry* registry); | 562 explicit TestAddAppWindowObserver(extensions::AppWindowRegistry* registry); |
| (...skipping 3034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3598 PrefService* prefs = browser()->profile()->GetPrefs(); | 3597 PrefService* prefs = browser()->profile()->GetPrefs(); |
| 3599 EXPECT_TRUE(extensions::MessageService::IsNativeMessagingHostAllowed( | 3598 EXPECT_TRUE(extensions::MessageService::IsNativeMessagingHostAllowed( |
| 3600 prefs, "host.name")); | 3599 prefs, "host.name")); |
| 3601 EXPECT_FALSE(extensions::MessageService::IsNativeMessagingHostAllowed( | 3600 EXPECT_FALSE(extensions::MessageService::IsNativeMessagingHostAllowed( |
| 3602 prefs, "other.host.name")); | 3601 prefs, "other.host.name")); |
| 3603 } | 3602 } |
| 3604 | 3603 |
| 3605 #endif // !defined(CHROME_OS) | 3604 #endif // !defined(CHROME_OS) |
| 3606 | 3605 |
| 3607 } // namespace policy | 3606 } // namespace policy |
| OLD | NEW |