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

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

Issue 151195: Simplifying renderer focus management (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 | « no previous file | webkit/glue/webframe_impl.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 2133 matching lines...) Expand 10 before | Expand all | Expand 10 after
2144 // the frame, otherwise it will report 'no match' if the focused frame has 2144 // the frame, otherwise it will report 'no match' if the focused frame has
2145 // reported matches, but no frames after the focused_frame contain a 2145 // reported matches, but no frames after the focused_frame contain a
2146 // match for the search word(s). 2146 // match for the search word(s).
2147 if (multi_frame && search_frame == focused_frame) { 2147 if (multi_frame && search_frame == focused_frame) {
2148 result = search_frame->Find( 2148 result = search_frame->Find(
2149 request_id, search_text, options, true, // Force wrapping. 2149 request_id, search_text, options, true, // Force wrapping.
2150 &selection_rect); 2150 &selection_rect);
2151 } 2151 }
2152 } 2152 }
2153 2153
2154 // TODO(jcampan): http://b/issue?id=1157486 Remove StoreForFocus call once
2155 // we have the fix for 792423.
2156 search_frame->GetView()->StoreFocusForFrame(search_frame);
2157 webview()->SetFocusedFrame(search_frame); 2154 webview()->SetFocusedFrame(search_frame);
2158 } while (!result && search_frame != focused_frame); 2155 } while (!result && search_frame != focused_frame);
2159 2156
2160 // Make sure we don't leave any frame focused or the focus won't be restored
2161 // properly in WebViewImpl::SetFocus(). Note that we are talking here about
2162 // focused on the SelectionController, not FocusController.
2163 // webview()->GetFocusedFrame() will still return the last focused frame (as
2164 // it queries the FocusController).
2165 // TODO(jcampan): http://b/issue?id=1157486 Remove next line once we have the
2166 // fix for 792423.
2167 webview()->SetFocusedFrame(NULL);
2168
2169 if (options.findNext) { 2157 if (options.findNext) {
2170 // Force the main_frame to report the actual count. 2158 // Force the main_frame to report the actual count.
2171 main_frame->IncreaseMatchCount(0, request_id); 2159 main_frame->IncreaseMatchCount(0, request_id);
2172 } else { 2160 } else {
2173 // If nothing is found, set result to "0 of 0", otherwise, set it to 2161 // If nothing is found, set result to "0 of 0", otherwise, set it to
2174 // "-1 of 1" to indicate that we found at least one item, but we don't know 2162 // "-1 of 1" to indicate that we found at least one item, but we don't know
2175 // yet what is active. 2163 // yet what is active.
2176 int ordinal = result ? -1 : 0; // -1 here means, we might know more later. 2164 int ordinal = result ? -1 : 0; // -1 here means, we might know more later.
2177 int match_count = result ? 1 : 0; // 1 here means possibly more coming. 2165 int match_count = result ? 1 : 0; // 1 here means possibly more coming.
2178 2166
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
2970 Send(new ViewHostMsg_PasswordFormsSeen(routing_id_, password_forms)); 2958 Send(new ViewHostMsg_PasswordFormsSeen(routing_id_, password_forms));
2971 } 2959 }
2972 2960
2973 void RenderView::Print(WebFrame* frame, bool script_initiated) { 2961 void RenderView::Print(WebFrame* frame, bool script_initiated) {
2974 DCHECK(frame); 2962 DCHECK(frame);
2975 if (print_helper_.get() == NULL) { 2963 if (print_helper_.get() == NULL) {
2976 print_helper_.reset(new PrintWebViewHelper(this)); 2964 print_helper_.reset(new PrintWebViewHelper(this));
2977 } 2965 }
2978 print_helper_->Print(frame, script_initiated); 2966 print_helper_->Print(frame, script_initiated);
2979 } 2967 }
OLDNEW
« no previous file with comments | « no previous file | webkit/glue/webframe_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698