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

Side by Side Diff: chrome/renderer/render_view.cc

Issue 246060: Revert 27705 - Move various methods from glue/webview.h to api/public/WebView... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 2 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
« no previous file with comments | « chrome/renderer/print_web_view_helper.cc ('k') | chrome/renderer/webplugin_delegate_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/renderer/render_view.h" 5 #include "chrome/renderer/render_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 decrement_shared_popup_at_destruction_ = true; 307 decrement_shared_popup_at_destruction_ = true;
308 } else { 308 } else {
309 shared_popup_counter_ = new SharedRenderViewCounter(0); 309 shared_popup_counter_ = new SharedRenderViewCounter(0);
310 decrement_shared_popup_at_destruction_ = false; 310 decrement_shared_popup_at_destruction_ = false;
311 } 311 }
312 312
313 devtools_agent_.reset(new DevToolsAgent(routing_id, this)); 313 devtools_agent_.reset(new DevToolsAgent(routing_id, this));
314 314
315 webwidget_ = WebView::Create(this); 315 webwidget_ = WebView::Create(this);
316 webkit_preferences_.Apply(webview()); 316 webkit_preferences_.Apply(webview());
317 webview()->initializeMainFrame(this); 317 webview()->InitializeMainFrame(this);
318 318
319 OnSetRendererPrefs(renderer_prefs); 319 OnSetRendererPrefs(renderer_prefs);
320 320
321 // Don't let WebCore keep a B/F list - we have our own.
322 // We let it keep 1 entry because FrameLoader::goToItem expects an item in the
323 // backForwardList, which is used only in ASSERTs.
324 webview()->SetBackForwardListSize(1);
325
321 routing_id_ = routing_id; 326 routing_id_ = routing_id;
322 render_thread_->AddRoute(routing_id_, this); 327 render_thread_->AddRoute(routing_id_, this);
323 // Take a reference on behalf of the RenderThread. This will be balanced 328 // Take a reference on behalf of the RenderThread. This will be balanced
324 // when we receive ViewMsg_Close. 329 // when we receive ViewMsg_Close.
325 AddRef(); 330 AddRef();
326 331
327 // If this is a popup, we must wait for the CreatingNew_ACK message before 332 // If this is a popup, we must wait for the CreatingNew_ACK message before
328 // completing initialization. Otherwise, we can finish it now. 333 // completing initialization. Otherwise, we can finish it now.
329 if (opener_id == MSG_ROUTING_NONE) { 334 if (opener_id == MSG_ROUTING_NONE) {
330 did_show_ = true; 335 did_show_ = true;
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 main_frame->loadRequest(request); 736 main_frame->loadRequest(request);
732 } 737 }
733 738
734 // In case LoadRequest failed before DidCreateDataSource was called. 739 // In case LoadRequest failed before DidCreateDataSource was called.
735 pending_navigation_state_.reset(); 740 pending_navigation_state_.reset();
736 } 741 }
737 742
738 // Stop loading the current page 743 // Stop loading the current page
739 void RenderView::OnStop() { 744 void RenderView::OnStop() {
740 if (webview()) 745 if (webview())
741 webview()->mainFrame()->stopLoading(); 746 webview()->StopLoading();
742 } 747 }
743 748
744 void RenderView::OnLoadAlternateHTMLText(const std::string& html, 749 void RenderView::OnLoadAlternateHTMLText(const std::string& html,
745 bool new_navigation, 750 bool new_navigation,
746 const GURL& display_url, 751 const GURL& display_url,
747 const std::string& security_info) { 752 const std::string& security_info) {
748 if (!webview()) 753 if (!webview())
749 return; 754 return;
750 755
751 pending_navigation_state_.reset(NavigationState::CreateBrowserInitiated( 756 pending_navigation_state_.reset(NavigationState::CreateBrowserInitiated(
(...skipping 28 matching lines...) Expand all
780 WebView* view = webview(); 785 WebView* view = webview();
781 if (!view) 786 if (!view)
782 return; 787 return;
783 788
784 if (clear_selection) 789 if (clear_selection)
785 view->focusedFrame()->executeCommand(WebString::fromUTF8("Unselect")); 790 view->focusedFrame()->executeCommand(WebString::fromUTF8("Unselect"));
786 791
787 WebFrame* frame = view->mainFrame(); 792 WebFrame* frame = view->mainFrame();
788 while (frame) { 793 while (frame) {
789 frame->stopFinding(clear_selection); 794 frame->stopFinding(clear_selection);
790 frame = frame->traverseNext(false); 795 frame = view->GetNextFrameAfter(frame, false);
791 } 796 }
792 } 797 }
793 798
794 void RenderView::OnFindReplyAck() { 799 void RenderView::OnFindReplyAck() {
795 // Check if there is any queued up request waiting to be sent. 800 // Check if there is any queued up request waiting to be sent.
796 if (queued_find_reply_message_.get()) { 801 if (queued_find_reply_message_.get()) {
797 // Send the search result over to the browser process. 802 // Send the search result over to the browser process.
798 Send(queued_find_reply_message_.get()); 803 Send(queued_find_reply_message_.get());
799 queued_find_reply_message_.release(); 804 queued_find_reply_message_.release();
800 } 805 }
(...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after
2575 GURL::Replacements link_doctor_params; 2580 GURL::Replacements link_doctor_params;
2576 link_doctor_params.SetQueryStr(params); 2581 link_doctor_params.SetQueryStr(params);
2577 GURL url = alternate_error_page_url_.ReplaceComponents(link_doctor_params); 2582 GURL url = alternate_error_page_url_.ReplaceComponents(link_doctor_params);
2578 return url; 2583 return url;
2579 } 2584 }
2580 2585
2581 void RenderView::OnFind(int request_id, 2586 void RenderView::OnFind(int request_id,
2582 const string16& search_text, 2587 const string16& search_text,
2583 const WebKit::WebFindOptions& options) { 2588 const WebKit::WebFindOptions& options) {
2584 WebFrame* main_frame = webview()->mainFrame(); 2589 WebFrame* main_frame = webview()->mainFrame();
2585 WebFrame* frame_after_main = main_frame->traverseNext(true); 2590 WebFrame* frame_after_main = webview()->GetNextFrameAfter(main_frame, true);
2586 WebFrame* focused_frame = webview()->focusedFrame(); 2591 WebFrame* focused_frame = webview()->focusedFrame();
2587 WebFrame* search_frame = focused_frame; // start searching focused frame. 2592 WebFrame* search_frame = focused_frame; // start searching focused frame.
2588 2593
2589 bool multi_frame = (frame_after_main != main_frame); 2594 bool multi_frame = (frame_after_main != main_frame);
2590 2595
2591 // If we have multiple frames, we don't want to wrap the search within the 2596 // If we have multiple frames, we don't want to wrap the search within the
2592 // frame, so we check here if we only have main_frame in the chain. 2597 // frame, so we check here if we only have main_frame in the chain.
2593 bool wrap_within_frame = !multi_frame; 2598 bool wrap_within_frame = !multi_frame;
2594 2599
2595 WebRect selection_rect; 2600 WebRect selection_rect;
2596 bool result = false; 2601 bool result = false;
2597 2602
2598 do { 2603 do {
2599 result = search_frame->find( 2604 result = search_frame->find(
2600 request_id, search_text, options, wrap_within_frame, &selection_rect); 2605 request_id, search_text, options, wrap_within_frame, &selection_rect);
2601 2606
2602 if (!result) { 2607 if (!result) {
2603 // don't leave text selected as you move to the next frame. 2608 // don't leave text selected as you move to the next frame.
2604 search_frame->executeCommand(WebString::fromUTF8("Unselect")); 2609 search_frame->executeCommand(WebString::fromUTF8("Unselect"));
2605 2610
2606 // Find the next frame, but skip the invisible ones. 2611 // Find the next frame, but skip the invisible ones.
2607 do { 2612 do {
2608 // What is the next frame to search? (we might be going backwards). Note 2613 // What is the next frame to search? (we might be going backwards). Note
2609 // that we specify wrap=true so that search_frame never becomes NULL. 2614 // that we specify wrap=true so that search_frame never becomes NULL.
2610 search_frame = options.forward ? 2615 search_frame = options.forward ?
2611 search_frame->traverseNext(true) : 2616 webview()->GetNextFrameAfter(search_frame, true) :
2612 search_frame->traversePrevious(true); 2617 webview()->GetPreviousFrameBefore(search_frame, true);
2613 } while (!search_frame->hasVisibleContent() && 2618 } while (!search_frame->hasVisibleContent() &&
2614 search_frame != focused_frame); 2619 search_frame != focused_frame);
2615 2620
2616 // Make sure selection doesn't affect the search operation in new frame. 2621 // Make sure selection doesn't affect the search operation in new frame.
2617 search_frame->executeCommand(WebString::fromUTF8("Unselect")); 2622 search_frame->executeCommand(WebString::fromUTF8("Unselect"));
2618 2623
2619 // If we have multiple frames and we have wrapped back around to the 2624 // If we have multiple frames and we have wrapped back around to the
2620 // focused frame, we need to search it once more allowing wrap within 2625 // focused frame, we need to search it once more allowing wrap within
2621 // the frame, otherwise it will report 'no match' if the focused frame has 2626 // the frame, otherwise it will report 'no match' if the focused frame has
2622 // reported matches, but no frames after the focused_frame contain a 2627 // reported matches, but no frames after the focused_frame contain a
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2668 // Start new scoping request. If the scoping function determines that it 2673 // Start new scoping request. If the scoping function determines that it
2669 // needs to scope, it will defer until later. 2674 // needs to scope, it will defer until later.
2670 search_frame->scopeStringMatches(request_id, 2675 search_frame->scopeStringMatches(request_id,
2671 search_text, 2676 search_text,
2672 options, 2677 options,
2673 true); // reset the tickmarks 2678 true); // reset the tickmarks
2674 } 2679 }
2675 2680
2676 // Iterate to the next frame. The frame will not necessarily scope, for 2681 // Iterate to the next frame. The frame will not necessarily scope, for
2677 // example if it is not visible. 2682 // example if it is not visible.
2678 search_frame = search_frame->traverseNext(true); 2683 search_frame = webview()->GetNextFrameAfter(search_frame, true);
2679 } while (search_frame != main_frame); 2684 } while (search_frame != main_frame);
2680 } 2685 }
2681 } 2686 }
2682 2687
2683 void RenderView::OnDeterminePageText() { 2688 void RenderView::OnDeterminePageText() {
2684 if (!is_loading_) { 2689 if (!is_loading_) {
2685 if (!webview()) 2690 if (!webview())
2686 return; 2691 return;
2687 WebFrame* main_frame = webview()->mainFrame(); 2692 WebFrame* main_frame = webview()->mainFrame();
2688 std::wstring contents; 2693 std::wstring contents;
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
3265 RenderWidget::OnResize(new_size, resizer_rect); 3270 RenderWidget::OnResize(new_size, resizer_rect);
3266 } 3271 }
3267 3272
3268 void RenderView::OnClearFocusedNode() { 3273 void RenderView::OnClearFocusedNode() {
3269 if (webview()) 3274 if (webview())
3270 webview()->clearFocusedNode(); 3275 webview()->clearFocusedNode();
3271 } 3276 }
3272 3277
3273 void RenderView::OnSetBackground(const SkBitmap& background) { 3278 void RenderView::OnSetBackground(const SkBitmap& background) {
3274 if (webview()) 3279 if (webview())
3275 webview()->setIsTransparent(!background.empty()); 3280 webview()->SetIsTransparent(!background.empty());
3276 3281
3277 SetBackground(background); 3282 SetBackground(background);
3278 } 3283 }
3279 3284
3280 void RenderView::OnSetActive(bool active) { 3285 void RenderView::OnSetActive(bool active) {
3281 if (webview()) 3286 if (webview())
3282 webview()->setIsActive(active); 3287 webview()->SetActive(active);
3283 } 3288 }
3284 3289
3285 void RenderView::SendExtensionRequest(const std::string& name, 3290 void RenderView::SendExtensionRequest(const std::string& name,
3286 const std::string& args, 3291 const std::string& args,
3287 int request_id, 3292 int request_id,
3288 bool has_callback) { 3293 bool has_callback) {
3289 Send(new ViewHostMsg_ExtensionRequest(routing_id_, name, args, request_id, 3294 Send(new ViewHostMsg_ExtensionRequest(routing_id_, name, args, request_id,
3290 has_callback)); 3295 has_callback));
3291 } 3296 }
3292 3297
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
3610 new PluginMsg_SignalModalDialogEvent(host_window_)); 3615 new PluginMsg_SignalModalDialogEvent(host_window_));
3611 3616
3612 message->EnableMessagePumping(); // Runs a nested message loop. 3617 message->EnableMessagePumping(); // Runs a nested message loop.
3613 bool rv = Send(message); 3618 bool rv = Send(message);
3614 3619
3615 PluginChannelHost::Broadcast( 3620 PluginChannelHost::Broadcast(
3616 new PluginMsg_ResetModalDialogEvent(host_window_)); 3621 new PluginMsg_ResetModalDialogEvent(host_window_));
3617 3622
3618 return rv; 3623 return rv;
3619 } 3624 }
OLDNEW
« no previous file with comments | « chrome/renderer/print_web_view_helper.cc ('k') | chrome/renderer/webplugin_delegate_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698