Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Side by Side Diff: components/html_viewer/html_frame.cc

Issue 1340983002: Mandoline UI Process: Update namespaces and file names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated all the namespaces in mus Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "components/html_viewer/html_frame.h" 5 #include "components/html_viewer/html_frame.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 #include "ui/gfx/geometry/dip_util.h" 64 #include "ui/gfx/geometry/dip_util.h"
65 #include "ui/gfx/geometry/size.h" 65 #include "ui/gfx/geometry/size.h"
66 #include "url/gurl.h" 66 #include "url/gurl.h"
67 #include "url/origin.h" 67 #include "url/origin.h"
68 #include "url/url_constants.h" 68 #include "url/url_constants.h"
69 69
70 using mojo::AxProvider; 70 using mojo::AxProvider;
71 using mojo::Rect; 71 using mojo::Rect;
72 using mojo::ServiceProviderPtr; 72 using mojo::ServiceProviderPtr;
73 using mojo::URLResponsePtr; 73 using mojo::URLResponsePtr;
74 using mojo::View; 74 using mus::View;
75 using web_view::HTMLMessageEvent; 75 using web_view::HTMLMessageEvent;
76 using web_view::HTMLMessageEventPtr; 76 using web_view::HTMLMessageEventPtr;
77 77
78 namespace html_viewer { 78 namespace html_viewer {
79 namespace { 79 namespace {
80 80
81 const size_t kMaxTitleChars = 4 * 1024; 81 const size_t kMaxTitleChars = 4 * 1024;
82 82
83 web_view::NavigationTargetType WebNavigationPolicyToNavigationTarget( 83 web_view::NavigationTargetType WebNavigationPolicyToNavigationTarget(
84 blink::WebNavigationPolicy policy) { 84 blink::WebNavigationPolicy policy) {
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 } 268 }
269 parent_ = nullptr; 269 parent_ = nullptr;
270 270
271 frame_tree_manager_->OnFrameDestroyed(this); 271 frame_tree_manager_->OnFrameDestroyed(this);
272 272
273 if (delegate_) 273 if (delegate_)
274 delegate_->OnFrameDestroyed(); 274 delegate_->OnFrameDestroyed();
275 275
276 if (view_) { 276 if (view_) {
277 view_->RemoveObserver(this); 277 view_->RemoveObserver(this);
278 mojo::ScopedViewPtr::DeleteViewOrViewManager(view_); 278 mus::ScopedViewPtr::DeleteViewOrViewManager(view_);
279 } 279 }
280 } 280 }
281 281
282 blink::WebMediaPlayer* HTMLFrame::createMediaPlayer( 282 blink::WebMediaPlayer* HTMLFrame::createMediaPlayer(
283 blink::WebLocalFrame* frame, 283 blink::WebLocalFrame* frame,
284 const blink::WebURL& url, 284 const blink::WebURL& url,
285 blink::WebMediaPlayerClient* client, 285 blink::WebMediaPlayerClient* client,
286 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client, 286 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
287 blink::WebContentDecryptionModule* initial_cdm) { 287 blink::WebContentDecryptionModule* initial_cdm) {
288 return global_state()->media_factory()->CreateMediaPlayer( 288 return global_state()->media_factory()->CreateMediaPlayer(
289 frame, url, client, encrypted_client, initial_cdm, 289 frame, url, client, encrypted_client, initial_cdm,
290 GetLocalRootApp()->shell()); 290 GetLocalRootApp()->shell());
291 } 291 }
292 292
293 blink::WebFrame* HTMLFrame::createChildFrame( 293 blink::WebFrame* HTMLFrame::createChildFrame(
294 blink::WebLocalFrame* parent, 294 blink::WebLocalFrame* parent,
295 blink::WebTreeScopeType scope, 295 blink::WebTreeScopeType scope,
296 const blink::WebString& frame_name, 296 const blink::WebString& frame_name,
297 blink::WebSandboxFlags sandbox_flags) { 297 blink::WebSandboxFlags sandbox_flags) {
298 DCHECK(IsLocal()); // Can't create children of remote frames. 298 DCHECK(IsLocal()); // Can't create children of remote frames.
299 DCHECK_EQ(parent, web_frame_); 299 DCHECK_EQ(parent, web_frame_);
300 DCHECK(view_); // If we're local we have to have a view. 300 DCHECK(view_); // If we're local we have to have a view.
301 // Create the view that will house the frame now. We embed once we know the 301 // Create the view that will house the frame now. We embed once we know the
302 // url (see decidePolicyForNavigation()). 302 // url (see decidePolicyForNavigation()).
303 mojo::View* child_view = view_->connection()->CreateView(); 303 mus::View* child_view = view_->connection()->CreateView();
304 ReplicatedFrameState child_state; 304 ReplicatedFrameState child_state;
305 child_state.name = frame_name; 305 child_state.name = frame_name;
306 child_state.tree_scope = scope; 306 child_state.tree_scope = scope;
307 child_state.sandbox_flags = sandbox_flags; 307 child_state.sandbox_flags = sandbox_flags;
308 mojo::Map<mojo::String, mojo::Array<uint8_t>> client_properties; 308 mojo::Map<mojo::String, mojo::Array<uint8_t>> client_properties;
309 client_properties.mark_non_null(); 309 client_properties.mark_non_null();
310 ClientPropertiesFromReplicatedFrameState(child_state, &client_properties); 310 ClientPropertiesFromReplicatedFrameState(child_state, &client_properties);
311 311
312 child_view->SetVisible(true); 312 child_view->SetVisible(true);
313 view_->AddChild(child_view); 313 view_->AddChild(child_view);
314 314
315 GetLocalRoot()->server_->OnCreatedFrame(id_, child_view->id(), 315 GetLocalRoot()->server_->OnCreatedFrame(id_, child_view->id(),
316 client_properties.Pass()); 316 client_properties.Pass());
317 317
318 HTMLFrame::CreateParams params(frame_tree_manager_, this, child_view->id(), 318 HTMLFrame::CreateParams params(frame_tree_manager_, this, child_view->id(),
319 child_view, client_properties, nullptr); 319 child_view, client_properties, nullptr);
320 params.allow_local_shared_frame = true; 320 params.allow_local_shared_frame = true;
321 HTMLFrame* child_frame = 321 HTMLFrame* child_frame =
322 GetLocalRoot()->delegate_->GetHTMLFactory()->CreateHTMLFrame(&params); 322 GetLocalRoot()->delegate_->GetHTMLFactory()->CreateHTMLFrame(&params);
323 child_frame->owned_view_.reset(new mojo::ScopedViewPtr(child_view)); 323 child_frame->owned_view_.reset(new mus::ScopedViewPtr(child_view));
324 return child_frame->web_frame_; 324 return child_frame->web_frame_;
325 } 325 }
326 326
327 void HTMLFrame::frameDetached(blink::WebFrame* web_frame, 327 void HTMLFrame::frameDetached(blink::WebFrame* web_frame,
328 blink::WebFrameClient::DetachType type) { 328 blink::WebFrameClient::DetachType type) {
329 if (type == blink::WebFrameClient::DetachType::Swap) { 329 if (type == blink::WebFrameClient::DetachType::Swap) {
330 web_frame->close(); 330 web_frame->close();
331 return; 331 return;
332 } 332 }
333 333
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 // Prefer the local root. 496 // Prefer the local root.
497 HTMLFrame* local_root = GetLocalRoot(); 497 HTMLFrame* local_root = GetLocalRoot();
498 if (local_root) 498 if (local_root)
499 return local_root->server_.get(); 499 return local_root->server_.get();
500 500
501 // No local root. This means we're a remote frame with no local frame 501 // No local root. This means we're a remote frame with no local frame
502 // ancestors. Use the local frame from the FrameTreeServer. 502 // ancestors. Use the local frame from the FrameTreeServer.
503 return frame_tree_manager_->local_root_->server_.get(); 503 return frame_tree_manager_->local_root_->server_.get();
504 } 504 }
505 505
506 void HTMLFrame::SetView(mojo::View* view) { 506 void HTMLFrame::SetView(mus::View* view) {
507 if (view_) 507 if (view_)
508 view_->RemoveObserver(this); 508 view_->RemoveObserver(this);
509 view_ = view; 509 view_ = view;
510 if (view_) 510 if (view_)
511 view_->AddObserver(this); 511 view_->AddObserver(this);
512 } 512 }
513 513
514 void HTMLFrame::CreateRootWebWidget() { 514 void HTMLFrame::CreateRootWebWidget() {
515 DCHECK(!html_widget_); 515 DCHECK(!html_widget_);
516 if (view_) { 516 if (view_) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 remote_frame->setReplicatedOrigin(state_.origin); 563 remote_frame->setReplicatedOrigin(state_.origin);
564 remote_frame->setReplicatedSandboxFlags(state_.sandbox_flags); 564 remote_frame->setReplicatedSandboxFlags(state_.sandbox_flags);
565 web_frame_ = remote_frame; 565 web_frame_ = remote_frame;
566 SetView(nullptr); 566 SetView(nullptr);
567 if (delegate) 567 if (delegate)
568 delegate->OnFrameSwappedToRemote(); 568 delegate->OnFrameSwappedToRemote();
569 } 569 }
570 570
571 void HTMLFrame::SwapToLocal( 571 void HTMLFrame::SwapToLocal(
572 HTMLFrameDelegate* delegate, 572 HTMLFrameDelegate* delegate,
573 mojo::View* view, 573 mus::View* view,
574 const mojo::Map<mojo::String, mojo::Array<uint8_t>>& properties) { 574 const mojo::Map<mojo::String, mojo::Array<uint8_t>>& properties) {
575 CHECK(!IsLocal()); 575 CHECK(!IsLocal());
576 // It doesn't make sense for the root to swap to local. 576 // It doesn't make sense for the root to swap to local.
577 CHECK(parent_); 577 CHECK(parent_);
578 delegate_ = delegate; 578 delegate_ = delegate;
579 SetView(view); 579 SetView(view);
580 SetReplicatedFrameStateFromClientProperties(properties, &state_); 580 SetReplicatedFrameStateFromClientProperties(properties, &state_);
581 blink::WebLocalFrame* local_web_frame = 581 blink::WebLocalFrame* local_web_frame =
582 blink::WebLocalFrame::create(state_.tree_scope, this); 582 blink::WebLocalFrame::create(state_.tree_scope, this);
583 local_web_frame->initializeToReplaceRemoteFrame( 583 local_web_frame->initializeToReplaceRemoteFrame(
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 662
663 if (!web_widget) 663 if (!web_widget)
664 return; 664 return;
665 665
666 scoped_ptr<blink::WebInputEvent> web_event = 666 scoped_ptr<blink::WebInputEvent> web_event =
667 event.To<scoped_ptr<blink::WebInputEvent>>(); 667 event.To<scoped_ptr<blink::WebInputEvent>>();
668 if (web_event) 668 if (web_event)
669 web_widget->handleInputEvent(*web_event); 669 web_widget->handleInputEvent(*web_event);
670 } 670 }
671 671
672 void HTMLFrame::OnViewFocusChanged(mojo::View* gained_focus, 672 void HTMLFrame::OnViewFocusChanged(mus::View* gained_focus,
673 mojo::View* lost_focus) { 673 mus::View* lost_focus) {
674 UpdateFocus(); 674 UpdateFocus();
675 } 675 }
676 676
677 void HTMLFrame::OnConnect(web_view::FrameTreeServerPtr server, 677 void HTMLFrame::OnConnect(web_view::FrameTreeServerPtr server,
678 uint32_t change_id, 678 uint32_t change_id,
679 uint32_t view_id, 679 uint32_t view_id,
680 web_view::ViewConnectType view_connect_type, 680 web_view::ViewConnectType view_connect_type,
681 mojo::Array<web_view::FrameDataPtr> frame_data, 681 mojo::Array<web_view::FrameDataPtr> frame_data,
682 const OnConnectCallback& callback) { 682 const OnConnectCallback& callback) {
683 // OnConnect() is only sent once, and has been received (by 683 // OnConnect() is only sent once, and has been received (by
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 813
814 void HTMLFrame::reload(bool ignore_cache, bool is_client_redirect) { 814 void HTMLFrame::reload(bool ignore_cache, bool is_client_redirect) {
815 NOTIMPLEMENTED(); 815 NOTIMPLEMENTED();
816 } 816 }
817 817
818 void HTMLFrame::forwardInputEvent(const blink::WebInputEvent* event) { 818 void HTMLFrame::forwardInputEvent(const blink::WebInputEvent* event) {
819 NOTIMPLEMENTED(); 819 NOTIMPLEMENTED();
820 } 820 }
821 821
822 } // namespace mojo 822 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698