| 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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 : public content::WebContentsObserver { | 490 : public content::WebContentsObserver { |
| 491 public: | 491 public: |
| 492 explicit WebContentsLoadedOrDestroyedWatcher( | 492 explicit WebContentsLoadedOrDestroyedWatcher( |
| 493 content::WebContents* web_contents); | 493 content::WebContents* web_contents); |
| 494 virtual ~WebContentsLoadedOrDestroyedWatcher(); | 494 virtual ~WebContentsLoadedOrDestroyedWatcher(); |
| 495 | 495 |
| 496 // Waits until the WebContents's load is done or until it is destroyed. | 496 // Waits until the WebContents's load is done or until it is destroyed. |
| 497 void Wait(); | 497 void Wait(); |
| 498 | 498 |
| 499 // Overridden WebContentsObserver methods. | 499 // Overridden WebContentsObserver methods. |
| 500 virtual void WebContentsDestroyed( | 500 virtual void WebContentsDestroyed() OVERRIDE; |
| 501 content::WebContents* web_contents) OVERRIDE; | |
| 502 virtual void DidStopLoading( | 501 virtual void DidStopLoading( |
| 503 content::RenderViewHost* render_view_host) OVERRIDE; | 502 content::RenderViewHost* render_view_host) OVERRIDE; |
| 504 | 503 |
| 505 private: | 504 private: |
| 506 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; | 505 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; |
| 507 | 506 |
| 508 DISALLOW_COPY_AND_ASSIGN(WebContentsLoadedOrDestroyedWatcher); | 507 DISALLOW_COPY_AND_ASSIGN(WebContentsLoadedOrDestroyedWatcher); |
| 509 }; | 508 }; |
| 510 | 509 |
| 511 WebContentsLoadedOrDestroyedWatcher::WebContentsLoadedOrDestroyedWatcher( | 510 WebContentsLoadedOrDestroyedWatcher::WebContentsLoadedOrDestroyedWatcher( |
| 512 content::WebContents* web_contents) | 511 content::WebContents* web_contents) |
| 513 : content::WebContentsObserver(web_contents), | 512 : content::WebContentsObserver(web_contents), |
| 514 message_loop_runner_(new content::MessageLoopRunner) { | 513 message_loop_runner_(new content::MessageLoopRunner) { |
| 515 } | 514 } |
| 516 | 515 |
| 517 WebContentsLoadedOrDestroyedWatcher::~WebContentsLoadedOrDestroyedWatcher() {} | 516 WebContentsLoadedOrDestroyedWatcher::~WebContentsLoadedOrDestroyedWatcher() {} |
| 518 | 517 |
| 519 void WebContentsLoadedOrDestroyedWatcher::Wait() { | 518 void WebContentsLoadedOrDestroyedWatcher::Wait() { |
| 520 message_loop_runner_->Run(); | 519 message_loop_runner_->Run(); |
| 521 } | 520 } |
| 522 | 521 |
| 523 void WebContentsLoadedOrDestroyedWatcher::WebContentsDestroyed( | 522 void WebContentsLoadedOrDestroyedWatcher::WebContentsDestroyed() { |
| 524 content::WebContents* web_contents) { | |
| 525 message_loop_runner_->Quit(); | 523 message_loop_runner_->Quit(); |
| 526 } | 524 } |
| 527 | 525 |
| 528 void WebContentsLoadedOrDestroyedWatcher::DidStopLoading( | 526 void WebContentsLoadedOrDestroyedWatcher::DidStopLoading( |
| 529 content::RenderViewHost* render_view_host) { | 527 content::RenderViewHost* render_view_host) { |
| 530 message_loop_runner_->Quit(); | 528 message_loop_runner_->Quit(); |
| 531 } | 529 } |
| 532 | 530 |
| 533 #if !defined(OS_MACOSX) | 531 #if !defined(OS_MACOSX) |
| 534 | 532 |
| (...skipping 2436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2971 PrefService* prefs = browser()->profile()->GetPrefs(); | 2969 PrefService* prefs = browser()->profile()->GetPrefs(); |
| 2972 EXPECT_TRUE(extensions::NativeMessageProcessHost::IsHostAllowed( | 2970 EXPECT_TRUE(extensions::NativeMessageProcessHost::IsHostAllowed( |
| 2973 prefs, "host.name")); | 2971 prefs, "host.name")); |
| 2974 EXPECT_FALSE(extensions::NativeMessageProcessHost::IsHostAllowed( | 2972 EXPECT_FALSE(extensions::NativeMessageProcessHost::IsHostAllowed( |
| 2975 prefs, "other.host.name")); | 2973 prefs, "other.host.name")); |
| 2976 } | 2974 } |
| 2977 | 2975 |
| 2978 #endif // !defined(CHROME_OS) | 2976 #endif // !defined(CHROME_OS) |
| 2979 | 2977 |
| 2980 } // namespace policy | 2978 } // namespace policy |
| OLD | NEW |