summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/render_view.cc
diff options
context:
space:
mode:
authorfinnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-24 00:10:29 +0000
committerfinnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-24 00:10:29 +0000
commit4f3dc3751d69f9db1f8ef533a3335201b3bc78bc (patch)
treee37efecf992ddd4e901c894273cbb1e5bf4260cc /chrome/renderer/render_view.cc
parent5e7f161f73f1817b8a0c422c0e4b5eceae6954e7 (diff)
downloadchromium_src-4f3dc3751d69f9db1f8ef533a3335201b3bc78bc.zip
chromium_src-4f3dc3751d69f9db1f8ef533a3335201b3bc78bc.tar.gz
chromium_src-4f3dc3751d69f9db1f8ef533a3335201b3bc78bc.tar.bz2
The find bar should be owned and managed from the BrowserView, not the WebContentsView, since it's part of the "chrome".
Design Doc: http://dev.chromium.org/developers/design-documents/find-bar Things done: - Pulled all of the find bar stuff out of WebContentsView* since it's no longer needed. - Moved OnFindReply delegate method from RenderViewHostDelegate::View to RenderViewHostDelegate, since it's no longer implemented on the view. - Moved find control methods to WebContents. - Added recent find result state to WebContents. - Updated the UI tests to accommodate the changes in the state that is broadcast when results are discovered. - Updated the find bar layout to obtain its bounding box from the BrowserView, which knows about toolbars, bookmark bars etc. - Updated the find bar itself to handle the fact that it can be displayed for multiple different tabs. - Moved the find bar manipulation methods for testing from TabProxy to BrowserProxy, since the find bar is now a feature of the window, not the tab. - view.h: Don't lay out child views again if they have a layout manager, it already updated them. TEST=Find box should work as before. BUG=3245 Review URL: http://codereview.chromium.org/27025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10231 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_view.cc')
-rw-r--r--chrome/renderer/render_view.cc47
1 files changed, 23 insertions, 24 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 4a5f360..22286f5 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -146,7 +146,7 @@ class RenderViewExtraRequestData : public WebRequest::ExtraData {
private:
int32 pending_page_id_;
- DISALLOW_EVIL_CONSTRUCTORS(RenderViewExtraRequestData);
+ DISALLOW_COPY_AND_ASSIGN(RenderViewExtraRequestData);
};
} // namespace
@@ -2191,28 +2191,27 @@ void RenderView::OnFind(const FindInPageRequest& request) {
// fix for 792423.
webview()->SetFocusedFrame(NULL);
- // We send back word that we found some matches, because we don't want to lag
- // when notifying the user that we found something. At this point we only know
- // that we found 1 match, but the scoping effort will tell us more. However,
- // if this is a FindNext request, the scoping effort is already under way, or
- // done already, so we have partial results. In that case we set it to -1 so
- // that it gets ignored by the FindInPageController.
- int match_count = result ? 1 : 0; // 1 here means possibly more coming.
- if (request.find_next)
- match_count = -1;
+ if (request.find_next) {
+ // Force the main_frame to report the actual count.
+ main_frame->IncreaseMatchCount(0, request.request_id);
+ } else {
+ // If nothing is found, set result to "0 of 0", otherwise, set it to
+ // "-1 of 1" to indicate that we found at least one item, but we don't know
+ // yet what is active.
+ int ordinal = result ? -1 : 0; // -1 here means, we might know more later.
+ int match_count = result ? 1 : 0; // 1 here means possibly more coming.
- // If we find no matches (or if this is Find Next) then this will be our last
- // status update. Otherwise the scoping effort will send more results.
- bool final_status_update = !result || request.find_next;
+ // If we find no matches then this will be our last status update.
+ // Otherwise the scoping effort will send more results.
+ bool final_status_update = !result;
- // Send the search result over to the browser process.
- Send(new ViewHostMsg_Find_Reply(routing_id_, request.request_id,
- match_count,
- selection_rect,
- -1, // Don't update active match ordinal.
- final_status_update));
+ // Send the search result over to the browser process.
+ Send(new ViewHostMsg_Find_Reply(routing_id_, request.request_id,
+ match_count,
+ selection_rect,
+ ordinal,
+ final_status_update));
- if (!request.find_next) {
// Scoping effort begins, starting with the mainframe.
search_frame = main_frame;
@@ -2871,7 +2870,7 @@ MessageLoop* RenderView::GetMessageLoopForIO() {
void RenderView::OnRequestAudioPacket(int stream_id) {
AudioRendererImpl* audio_renderer = audio_renderers_.Lookup(stream_id);
- if (!audio_renderer){
+ if (!audio_renderer) {
NOTREACHED();
return;
}
@@ -2881,7 +2880,7 @@ void RenderView::OnRequestAudioPacket(int stream_id) {
void RenderView::OnAudioStreamCreated(
int stream_id, base::SharedMemoryHandle handle, int length) {
AudioRendererImpl* audio_renderer = audio_renderers_.Lookup(stream_id);
- if (!audio_renderer){
+ if (!audio_renderer) {
NOTREACHED();
return;
}
@@ -2891,7 +2890,7 @@ void RenderView::OnAudioStreamCreated(
void RenderView::OnAudioStreamStateChanged(
int stream_id, AudioOutputStream::State state, int info) {
AudioRendererImpl* audio_renderer = audio_renderers_.Lookup(stream_id);
- if (!audio_renderer){
+ if (!audio_renderer) {
NOTREACHED();
return;
}
@@ -2900,7 +2899,7 @@ void RenderView::OnAudioStreamStateChanged(
void RenderView::OnAudioStreamVolume(int stream_id, double left, double right) {
AudioRendererImpl* audio_renderer = audio_renderers_.Lookup(stream_id);
- if (!audio_renderer){
+ if (!audio_renderer) {
NOTREACHED();
return;
}