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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 10829225: Browser Plugin: Add HTML5-like postMessage support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed crash + cleanup Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 // Used to allow users see what has been recognized as content. 367 // Used to allow users see what has been recognized as content.
368 static const size_t kContentIntentDelayMilliseconds = 700; 368 static const size_t kContentIntentDelayMilliseconds = 700;
369 #endif 369 #endif
370 370
371 static RenderViewImpl* FromRoutingID(int32 routing_id) { 371 static RenderViewImpl* FromRoutingID(int32 routing_id) {
372 return static_cast<RenderViewImpl*>( 372 return static_cast<RenderViewImpl*>(
373 ChildThread::current()->ResolveRoute(routing_id)); 373 ChildThread::current()->ResolveRoute(routing_id));
374 } 374 }
375 375
376 static WebKit::WebFrame* FindFrameByID(WebKit::WebFrame* root, int frame_id) { 376 static WebKit::WebFrame* FindFrameByID(WebKit::WebFrame* root, int frame_id) {
377 if (frame_id == -1)
378 return root;
379
377 for (WebFrame* frame = root; frame; frame = frame->traverseNext(false)) { 380 for (WebFrame* frame = root; frame; frame = frame->traverseNext(false)) {
378 if (frame->identifier() == frame_id) 381 if (frame->identifier() == frame_id)
379 return frame; 382 return frame;
380 } 383 }
381 return NULL; 384 return NULL;
382 } 385 }
383 386
384 static void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) { 387 static void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) {
385 WebVector<WebURL> urls; 388 WebVector<WebURL> urls;
386 ds->redirectChain(urls); 389 ds->redirectChain(urls);
(...skipping 3426 matching lines...) Expand 10 before | Expand all | Expand 10 after
3813 WebFrame* subframe = WebFrame::fromFrameOwnerElement(element); 3816 WebFrame* subframe = WebFrame::fromFrameOwnerElement(element);
3814 if (subframe) 3817 if (subframe)
3815 CreateFrameTree(subframe, child); 3818 CreateFrameTree(subframe, child);
3816 } else { 3819 } else {
3817 LOG(ERROR) << "Failed to append created iframe element."; 3820 LOG(ERROR) << "Failed to append created iframe element.";
3818 } 3821 }
3819 } 3822 }
3820 } 3823 }
3821 3824
3822 WebKit::WebFrame* RenderViewImpl::GetFrameByMappedID(int frame_id) { 3825 WebKit::WebFrame* RenderViewImpl::GetFrameByMappedID(int frame_id) {
3826 if (frame_id == -1)
3827 return webview()->mainFrame();
3828
3823 std::map<int, int>::iterator it = active_frame_id_map_.find(frame_id); 3829 std::map<int, int>::iterator it = active_frame_id_map_.find(frame_id);
3824 if (it == active_frame_id_map_.end()) 3830 if (it == active_frame_id_map_.end())
3825 return NULL; 3831 return NULL;
3826 3832
3827 return FindFrameByID(webview()->mainFrame(), it->second); 3833 return FindFrameByID(webview()->mainFrame(), it->second);
3828 } 3834 }
3829 3835
3830 void RenderViewImpl::EnsureMediaStreamImpl() { 3836 void RenderViewImpl::EnsureMediaStreamImpl() {
3831 if (!RenderThreadImpl::current()) // Will be NULL during unit tests. 3837 if (!RenderThreadImpl::current()) // Will be NULL during unit tests.
3832 return; 3838 return;
(...skipping 2312 matching lines...) Expand 10 before | Expand all | Expand 10 after
6145 DCHECK(!java_bridge_dispatcher_); 6151 DCHECK(!java_bridge_dispatcher_);
6146 #if defined(ENABLE_JAVA_BRIDGE) 6152 #if defined(ENABLE_JAVA_BRIDGE)
6147 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); 6153 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this);
6148 #endif 6154 #endif
6149 } 6155 }
6150 6156
6151 void RenderViewImpl::OnUpdatedFrameTree( 6157 void RenderViewImpl::OnUpdatedFrameTree(
6152 int process_id, 6158 int process_id,
6153 int route_id, 6159 int route_id,
6154 const std::string& frame_tree) { 6160 const std::string& frame_tree) {
6161 if (frame_tree.empty())
6162 return;
6163
6155 base::DictionaryValue* frames = NULL; 6164 base::DictionaryValue* frames = NULL;
6156 scoped_ptr<base::Value> tree(base::JSONReader::Read(frame_tree)); 6165 scoped_ptr<base::Value> tree(base::JSONReader::Read(frame_tree));
6157 if (tree.get() && tree->IsType(base::Value::TYPE_DICTIONARY)) 6166 if (tree.get() && tree->IsType(base::Value::TYPE_DICTIONARY)) {
6158 tree->GetAsDictionary(&frames); 6167 if (!tree->GetAsDictionary(&frames))
6168 return;
6169 }
6159 6170
6160 updating_frame_tree_ = true; 6171 updating_frame_tree_ = true;
6161 active_frame_id_map_.clear(); 6172 active_frame_id_map_.clear();
6162 6173
6163 target_process_id_ = process_id; 6174 target_process_id_ = process_id;
6164 target_routing_id_ = route_id; 6175 target_routing_id_ = route_id;
6165 CreateFrameTree(webview()->mainFrame(), frames); 6176 CreateFrameTree(webview()->mainFrame(), frames);
6166 6177
6167 updating_frame_tree_ = false; 6178 updating_frame_tree_ = false;
6168 } 6179 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698