OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "services/navigation/public/interfaces/view.mojom.h" | 9 #include "services/navigation/public/interfaces/view.mojom.h" |
10 #include "services/shell/public/cpp/shell_client.h" | 10 #include "services/shell/public/cpp/shell_client.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 mojom::ViewClientPtr GetViewClient() { | 29 mojom::ViewClientPtr GetViewClient() { |
30 return binding_.CreateInterfacePtrAndBind(); | 30 return binding_.CreateInterfacePtrAndBind(); |
31 } | 31 } |
32 | 32 |
33 void QuitOnLoadingStateChange(base::RunLoop* loop) { | 33 void QuitOnLoadingStateChange(base::RunLoop* loop) { |
34 loop_ = loop; | 34 loop_ = loop; |
35 } | 35 } |
36 | 36 |
37 private: | 37 private: |
38 // mojom::ViewClient: | 38 // mojom::ViewClient: |
| 39 void OpenURL(mojom::OpenURLParamsPtr params) override {} |
39 void LoadingStateChanged(bool is_loading) override { | 40 void LoadingStateChanged(bool is_loading) override { |
40 // Should see loading start, then stop. | 41 // Should see loading start, then stop. |
41 if (++load_count_ == 2 && loop_) | 42 if (++load_count_ == 2 && loop_) |
42 loop_->Quit(); | 43 loop_->Quit(); |
43 } | 44 } |
44 void NavigationStateChanged(const GURL& url, | 45 void NavigationStateChanged(const GURL& url, |
45 const mojo::String& title, | 46 const mojo::String& title, |
46 bool can_go_back, | 47 bool can_go_back, |
47 bool can_go_forward) override {} | 48 bool can_go_forward) override {} |
48 void LoadProgressChanged(double progress) override {} | 49 void LoadProgressChanged(double progress) override {} |
(...skipping 27 matching lines...) Expand all Loading... |
76 mojom::ViewPtr view; | 77 mojom::ViewPtr view; |
77 view_factory->CreateView(GetViewClient(), GetProxy(&view)); | 78 view_factory->CreateView(GetViewClient(), GetProxy(&view)); |
78 view->NavigateTo(GURL("about:blank")); | 79 view->NavigateTo(GURL("about:blank")); |
79 | 80 |
80 base::RunLoop loop; | 81 base::RunLoop loop; |
81 QuitOnLoadingStateChange(&loop); | 82 QuitOnLoadingStateChange(&loop); |
82 loop.Run(); | 83 loop.Run(); |
83 } | 84 } |
84 | 85 |
85 } // namespace navigation | 86 } // namespace navigation |
OLD | NEW |