OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "mash/webtest/webtest.h" | 5 #include "mash/webtest/webtest.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 ~UI() override { | 52 ~UI() override { |
53 webtest_->RemoveWindow(GetWidget()); | 53 webtest_->RemoveWindow(GetWidget()); |
54 } | 54 } |
55 | 55 |
56 void NavigateTo(const GURL& url) { | 56 void NavigateTo(const GURL& url) { |
57 view_->NavigateTo(url); | 57 view_->NavigateTo(url); |
58 } | 58 } |
59 | 59 |
60 private: | 60 private: |
61 // Overridden from views::WidgetDelegate: | 61 // Overridden from views::WidgetDelegate: |
62 views::View* GetContentsView() override { return this; } | |
63 base::string16 GetWindowTitle() const override { | 62 base::string16 GetWindowTitle() const override { |
64 // TODO(beng): use resources. | 63 // TODO(beng): use resources. |
65 if (current_title_.empty()) | 64 if (current_title_.empty()) |
66 return base::ASCIIToUTF16("navigation::View client"); | 65 return base::ASCIIToUTF16("navigation::View client"); |
67 base::string16 format = base::ASCIIToUTF16("%s - navigation::View client"); | 66 base::string16 format = base::ASCIIToUTF16("%s - navigation::View client"); |
68 base::ReplaceFirstSubstringAfterOffset( | 67 base::ReplaceFirstSubstringAfterOffset( |
69 &format, 0, base::ASCIIToUTF16("%s"), current_title_); | 68 &format, 0, base::ASCIIToUTF16("%s"), current_title_); |
70 return format; | 69 return format; |
71 } | 70 } |
72 bool CanResize() const override { return true; } | 71 bool CanResize() const override { return true; } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 AddWindow(window); | 194 AddWindow(window); |
196 } | 195 } |
197 | 196 |
198 void Webtest::Create(const shell::Identity& remote_identity, | 197 void Webtest::Create(const shell::Identity& remote_identity, |
199 mojom::LaunchableRequest request) { | 198 mojom::LaunchableRequest request) { |
200 bindings_.AddBinding(this, std::move(request)); | 199 bindings_.AddBinding(this, std::move(request)); |
201 } | 200 } |
202 | 201 |
203 } // namespace webtest | 202 } // namespace webtest |
204 } // namespace mash | 203 } // namespace mash |
OLD | NEW |