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

Side by Side Diff: chrome/browser/instant/instant_loader.cc

Issue 10809063: Adding Javascript support for the Extended Searchbox API. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Adding missing file from last upload. Created 8 years, 4 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
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 "chrome/browser/instant/instant_loader.h" 5 #include "chrome/browser/instant/instant_loader.h"
6 6
7 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 7 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
8 #include "chrome/browser/history/history_types.h" 8 #include "chrome/browser/history/history_types.h"
9 #include "chrome/browser/instant/instant_loader_delegate.h" 9 #include "chrome/browser/instant/instant_loader_delegate.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 virtual void DidFinishLoad( 67 virtual void DidFinishLoad(
68 int64 frame_id, 68 int64 frame_id,
69 const GURL& validated_url, 69 const GURL& validated_url,
70 bool is_main_frame, 70 bool is_main_frame,
71 content::RenderViewHost* render_view_host) OVERRIDE; 71 content::RenderViewHost* render_view_host) OVERRIDE;
72 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 72 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
73 73
74 private: 74 private:
75 // Message from renderer indicating the page has suggestions. 75 // Message from renderer indicating the page has suggestions.
76 void OnSetSuggestions(int page_id, 76 void OnSetSuggestions(int page_id,
77 const std::vector<string16>& suggestions, 77 const std::vector<InstantSuggestion>& suggestions);
78 InstantCompleteBehavior behavior);
79 78
80 // Message from the renderer determining whether it supports the Instant API. 79 // Message from the renderer determining whether it supports the Instant API.
81 void OnInstantSupportDetermined(int page_id, bool result); 80 void OnInstantSupportDetermined(int page_id, bool result);
82 81
83 void CommitFromPointerReleaseIfNecessary(); 82 void CommitFromPointerReleaseIfNecessary();
84 void MaybeSetAndNotifyInstantSupportDetermined(bool supports_instant); 83 void MaybeSetAndNotifyInstantSupportDetermined(bool supports_instant);
85 84
86 InstantLoader* const loader_; 85 InstantLoader* const loader_;
87 86
88 // True if the mouse or a touch pointer is down from an activate. 87 // True if the mouse or a touch pointer is down from an activate.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SetSuggestions, OnSetSuggestions) 190 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SetSuggestions, OnSetSuggestions)
192 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_InstantSupportDetermined, 191 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_InstantSupportDetermined,
193 OnInstantSupportDetermined) 192 OnInstantSupportDetermined)
194 IPC_MESSAGE_UNHANDLED(handled = false) 193 IPC_MESSAGE_UNHANDLED(handled = false)
195 IPC_END_MESSAGE_MAP() 194 IPC_END_MESSAGE_MAP()
196 return handled; 195 return handled;
197 } 196 }
198 197
199 void InstantLoader::WebContentsDelegateImpl::OnSetSuggestions( 198 void InstantLoader::WebContentsDelegateImpl::OnSetSuggestions(
200 int page_id, 199 int page_id,
201 const std::vector<string16>& suggestions, 200 const std::vector<InstantSuggestion>& suggestions) {
202 InstantCompleteBehavior behavior) {
203 content::NavigationEntry* entry = loader_->preview_contents_->web_contents()-> 201 content::NavigationEntry* entry = loader_->preview_contents_->web_contents()->
204 GetController().GetActiveEntry(); 202 GetController().GetActiveEntry();
205 if (entry && page_id == entry->GetPageID()) { 203 if (entry && page_id == entry->GetPageID()) {
206 MaybeSetAndNotifyInstantSupportDetermined(true); 204 MaybeSetAndNotifyInstantSupportDetermined(true);
207 loader_->loader_delegate_->SetSuggestions(loader_, suggestions, behavior); 205 loader_->loader_delegate_->SetSuggestions(loader_, suggestions);
208 } 206 }
209 } 207 }
210 208
211 void InstantLoader::WebContentsDelegateImpl::OnInstantSupportDetermined( 209 void InstantLoader::WebContentsDelegateImpl::OnInstantSupportDetermined(
212 int page_id, 210 int page_id,
213 bool result) { 211 bool result) {
214 content::NavigationEntry* entry = loader_->preview_contents_->web_contents()-> 212 content::NavigationEntry* entry = loader_->preview_contents_->web_contents()->
215 GetController().GetActiveEntry(); 213 GetController().GetActiveEntry();
216 if (entry && page_id == entry->GetPageID()) 214 if (entry && page_id == entry->GetPageID())
217 MaybeSetAndNotifyInstantSupportDetermined(result); 215 MaybeSetAndNotifyInstantSupportDetermined(result);
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 TabContents* new_tc) { 374 TabContents* new_tc) {
377 DCHECK(old_tc == preview_contents_); 375 DCHECK(old_tc == preview_contents_);
378 CleanupPreviewContents(); 376 CleanupPreviewContents();
379 // We release here without deleting so that the caller still has the 377 // We release here without deleting so that the caller still has the
380 // responsibility for deleting the TabContents. 378 // responsibility for deleting the TabContents.
381 ignore_result(preview_contents_.release()); 379 ignore_result(preview_contents_.release());
382 preview_contents_.reset(new_tc); 380 preview_contents_.reset(new_tc);
383 SetupPreviewContents(); 381 SetupPreviewContents();
384 loader_delegate_->SwappedTabContents(this); 382 loader_delegate_->SwappedTabContents(this);
385 } 383 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698