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 "services/navigation/view_impl.h" | 5 #include "services/navigation/view_impl.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "components/mus/public/cpp/window_tree_client.h" | 8 #include "components/mus/public/cpp/window_tree_client.h" |
9 #include "content/public/browser/interstitial_page.h" | 9 #include "content/public/browser/interstitial_page.h" |
10 #include "content/public/browser/interstitial_page_delegate.h" | 10 #include "content/public/browser/interstitial_page_delegate.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 new InterstitialPageDelegate(html)); | 88 new InterstitialPageDelegate(html)); |
89 interstitial->Show(); | 89 interstitial->Show(); |
90 } | 90 } |
91 | 91 |
92 void ViewImpl::HideInterstitial() { | 92 void ViewImpl::HideInterstitial() { |
93 // TODO(beng): this is not quite right. | 93 // TODO(beng): this is not quite right. |
94 if (web_view_->GetWebContents()->ShowingInterstitialPage()) | 94 if (web_view_->GetWebContents()->ShowingInterstitialPage()) |
95 web_view_->GetWebContents()->GetInterstitialPage()->Proceed(); | 95 web_view_->GetWebContents()->GetInterstitialPage()->Proceed(); |
96 } | 96 } |
97 | 97 |
| 98 void ViewImpl::SetResizerSize(const gfx::Size& size) { |
| 99 resizer_size_ = size; |
| 100 } |
| 101 |
98 void ViewImpl::AddNewContents(content::WebContents* source, | 102 void ViewImpl::AddNewContents(content::WebContents* source, |
99 content::WebContents* new_contents, | 103 content::WebContents* new_contents, |
100 WindowOpenDisposition disposition, | 104 WindowOpenDisposition disposition, |
101 const gfx::Rect& initial_rect, | 105 const gfx::Rect& initial_rect, |
102 bool user_gesture, | 106 bool user_gesture, |
103 bool* was_blocked) { | 107 bool* was_blocked) { |
104 mojom::ViewClientPtr client; | 108 mojom::ViewClientPtr client; |
105 mojom::ViewPtr view; | 109 mojom::ViewPtr view; |
106 mojom::ViewRequest view_request = GetProxy(&view); | 110 mojom::ViewRequest view_request = GetProxy(&view); |
107 client_->ViewCreated(std::move(view), GetProxy(&client), | 111 client_->ViewCreated(std::move(view), GetProxy(&client), |
(...skipping 26 matching lines...) Expand all Loading... |
134 base::UTF16ToUTF8(source->GetTitle()), | 138 base::UTF16ToUTF8(source->GetTitle()), |
135 source->GetController().CanGoBack(), | 139 source->GetController().CanGoBack(), |
136 source->GetController().CanGoForward()); | 140 source->GetController().CanGoForward()); |
137 } | 141 } |
138 | 142 |
139 void ViewImpl::LoadProgressChanged(content::WebContents* source, | 143 void ViewImpl::LoadProgressChanged(content::WebContents* source, |
140 double progress) { | 144 double progress) { |
141 client_->LoadProgressChanged(progress); | 145 client_->LoadProgressChanged(progress); |
142 } | 146 } |
143 | 147 |
| 148 void ViewImpl::UpdateTargetURL(content::WebContents* source, const GURL& url) { |
| 149 client_->UpdateHoverURL(url); |
| 150 } |
| 151 |
| 152 gfx::Rect ViewImpl::GetRootWindowResizerRect() const { |
| 153 gfx::Rect bounds = web_view_->GetLocalBounds(); |
| 154 return gfx::Rect(bounds.right() - resizer_size_.width(), |
| 155 bounds.bottom() - resizer_size_.height(), |
| 156 resizer_size_.width(), resizer_size_.height()); |
| 157 } |
| 158 |
144 void ViewImpl::OnEmbed(mus::Window* root) { | 159 void ViewImpl::OnEmbed(mus::Window* root) { |
145 DCHECK(!widget_.get()); | 160 DCHECK(!widget_.get()); |
146 widget_.reset(new views::Widget); | 161 widget_.reset(new views::Widget); |
147 views::Widget::InitParams params( | 162 views::Widget::InitParams params( |
148 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 163 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
149 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 164 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
150 params.delegate = this; | 165 params.delegate = this; |
151 params.native_widget = new views::NativeWidgetMus( | 166 params.native_widget = new views::NativeWidgetMus( |
152 widget_.get(), connector_, root, mus::mojom::SurfaceType::DEFAULT); | 167 widget_.get(), connector_, root, mus::mojom::SurfaceType::DEFAULT); |
153 widget_->Init(params); | 168 widget_->Init(params); |
154 widget_->Show(); | 169 widget_->Show(); |
155 } | 170 } |
156 | 171 |
157 void ViewImpl::OnWindowTreeClientDestroyed(mus::WindowTreeClient* client) {} | 172 void ViewImpl::OnWindowTreeClientDestroyed(mus::WindowTreeClient* client) {} |
158 void ViewImpl::OnEventObserved(const ui::Event& event, mus::Window* target) {} | 173 void ViewImpl::OnEventObserved(const ui::Event& event, mus::Window* target) {} |
159 | 174 |
160 views::View* ViewImpl::GetContentsView() { | 175 views::View* ViewImpl::GetContentsView() { |
161 return web_view_; | 176 return web_view_; |
162 } | 177 } |
163 | 178 |
164 views::Widget* ViewImpl::GetWidget() { | 179 views::Widget* ViewImpl::GetWidget() { |
165 return web_view_->GetWidget(); | 180 return web_view_->GetWidget(); |
166 } | 181 } |
167 | 182 |
168 const views::Widget* ViewImpl::GetWidget() const { | 183 const views::Widget* ViewImpl::GetWidget() const { |
169 return web_view_->GetWidget(); | 184 return web_view_->GetWidget(); |
170 } | 185 } |
171 | 186 |
172 } // navigation | 187 } // navigation |
OLD | NEW |