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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 103633002: Add RenderFrameHostDelegate and plumb it through all the necessary classes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/frame_host/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include "base/containers/hash_tables.h" 7 #include "base/containers/hash_tables.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "content/browser/frame_host/frame_tree.h" 9 #include "content/browser/frame_host/frame_tree.h"
10 #include "content/browser/frame_host/render_frame_host_delegate.h"
10 #include "content/browser/renderer_host/render_view_host_impl.h" 11 #include "content/browser/renderer_host/render_view_host_impl.h"
11 #include "content/common/frame_messages.h" 12 #include "content/common/frame_messages.h"
12 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
13 #include "content/public/browser/render_process_host.h" 14 #include "content/public/browser/render_process_host.h"
14 #include "url/gurl.h" 15 #include "url/gurl.h"
15 16
16 namespace content { 17 namespace content {
17 18
18 // The (process id, routing id) pair that identifies one RenderFrame. 19 // The (process id, routing id) pair that identifies one RenderFrame.
19 typedef std::pair<int32, int32> RenderFrameHostID; 20 typedef std::pair<int32, int32> RenderFrameHostID;
20 typedef base::hash_map<RenderFrameHostID, RenderFrameHostImpl*> 21 typedef base::hash_map<RenderFrameHostID, RenderFrameHostImpl*>
21 RoutingIDFrameMap; 22 RoutingIDFrameMap;
22 static base::LazyInstance<RoutingIDFrameMap> g_routing_id_frame_map = 23 static base::LazyInstance<RoutingIDFrameMap> g_routing_id_frame_map =
23 LAZY_INSTANCE_INITIALIZER; 24 LAZY_INSTANCE_INITIALIZER;
24 25
25 // static 26 // static
26 RenderFrameHostImpl* RenderFrameHostImpl::FromID( 27 RenderFrameHostImpl* RenderFrameHostImpl::FromID(
27 int process_id, int routing_id) { 28 int process_id, int routing_id) {
28 RoutingIDFrameMap* frames = g_routing_id_frame_map.Pointer(); 29 RoutingIDFrameMap* frames = g_routing_id_frame_map.Pointer();
29 RoutingIDFrameMap::iterator it = frames->find( 30 RoutingIDFrameMap::iterator it = frames->find(
30 RenderFrameHostID(process_id, routing_id)); 31 RenderFrameHostID(process_id, routing_id));
31 return it == frames->end() ? NULL : it->second; 32 return it == frames->end() ? NULL : it->second;
32 } 33 }
33 34
34 RenderFrameHostImpl::RenderFrameHostImpl( 35 RenderFrameHostImpl::RenderFrameHostImpl(
35 RenderViewHostImpl* render_view_host, 36 RenderViewHostImpl* render_view_host,
37 RenderFrameHostDelegate* delegate,
36 FrameTree* frame_tree, 38 FrameTree* frame_tree,
37 int routing_id, 39 int routing_id,
38 bool is_swapped_out) 40 bool is_swapped_out)
39 : render_view_host_(render_view_host), 41 : render_view_host_(render_view_host),
42 delegate_(delegate),
40 frame_tree_(frame_tree), 43 frame_tree_(frame_tree),
41 routing_id_(routing_id), 44 routing_id_(routing_id),
42 is_swapped_out_(is_swapped_out) { 45 is_swapped_out_(is_swapped_out) {
43 GetProcess()->AddRoute(routing_id_, this); 46 GetProcess()->AddRoute(routing_id_, this);
44 g_routing_id_frame_map.Get().insert(std::make_pair( 47 g_routing_id_frame_map.Get().insert(std::make_pair(
45 RenderFrameHostID(GetProcess()->GetID(), routing_id_), 48 RenderFrameHostID(GetProcess()->GetID(), routing_id_),
46 this)); 49 this));
47 } 50 }
48 51
49 RenderFrameHostImpl::~RenderFrameHostImpl() { 52 RenderFrameHostImpl::~RenderFrameHostImpl() {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 void RenderFrameHostImpl::OnDidStartProvisionalLoadForFrame( 97 void RenderFrameHostImpl::OnDidStartProvisionalLoadForFrame(
95 int64 frame_id, 98 int64 frame_id,
96 int64 parent_frame_id, 99 int64 parent_frame_id,
97 bool is_main_frame, 100 bool is_main_frame,
98 const GURL& url) { 101 const GURL& url) {
99 render_view_host_->OnDidStartProvisionalLoadForFrame( 102 render_view_host_->OnDidStartProvisionalLoadForFrame(
100 frame_id, parent_frame_id, is_main_frame, url); 103 frame_id, parent_frame_id, is_main_frame, url);
101 } 104 }
102 105
103 } // namespace content 106 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/browser/frame_host/render_frame_host_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698