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

Side by Side Diff: chrome/browser/ui/omnibox/omnibox_current_page_delegate_impl.cc

Issue 21395002: [InstantExtended] Fixing how PageLoadSRP is emitted. Previously it was emitted only for Instant sea… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: last upload didn't seem to work Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ui/omnibox/omnibox_current_page_delegate_impl.h" 5 #include "chrome/browser/ui/omnibox/omnibox_current_page_delegate_impl.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/autocomplete/autocomplete_match.h" 8 #include "chrome/browser/autocomplete/autocomplete_match.h"
9 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" 9 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h"
10 #include "chrome/browser/predictors/autocomplete_action_predictor.h" 10 #include "chrome/browser/predictors/autocomplete_action_predictor.h"
11 #include "chrome/browser/predictors/autocomplete_action_predictor_factory.h" 11 #include "chrome/browser/predictors/autocomplete_action_predictor_factory.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/search/search.h" 13 #include "chrome/browser/search/search.h"
14 #include "chrome/browser/search_engines/template_url_service.h"
15 #include "chrome/browser/search_engines/template_url_service_factory.h"
14 #include "chrome/browser/sessions/session_tab_helper.h" 16 #include "chrome/browser/sessions/session_tab_helper.h"
15 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" 17 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h"
16 #include "chrome/browser/ui/search/search_tab_helper.h" 18 #include "chrome/browser/ui/search/search_tab_helper.h"
17 #include "content/public/browser/navigation_controller.h" 19 #include "content/public/browser/navigation_controller.h"
18 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
19 #include "content/public/browser/web_contents_view.h" 21 #include "content/public/browser/web_contents_view.h"
20 #include "ui/base/window_open_disposition.h" 22 #include "ui/base/window_open_disposition.h"
21 #include "url/gurl.h" 23 #include "url/gurl.h"
22 24
23 OmniboxCurrentPageDelegateImpl::OmniboxCurrentPageDelegateImpl( 25 OmniboxCurrentPageDelegateImpl::OmniboxCurrentPageDelegateImpl(
24 OmniboxEditController* controller, 26 OmniboxEditController* controller,
25 Profile* profile) 27 Profile* profile)
26 : controller_(controller), 28 : controller_(controller),
27 profile_(profile) {} 29 profile_(profile) {}
28 30
29 OmniboxCurrentPageDelegateImpl::~OmniboxCurrentPageDelegateImpl() {} 31 OmniboxCurrentPageDelegateImpl::~OmniboxCurrentPageDelegateImpl() {}
30 32
31 bool OmniboxCurrentPageDelegateImpl::CurrentPageExists() const { 33 bool OmniboxCurrentPageDelegateImpl::CurrentPageExists() const {
32 return (controller_->GetWebContents() != NULL); 34 return (controller_->GetWebContents() != NULL);
33 } 35 }
34 36
35 const GURL& OmniboxCurrentPageDelegateImpl::GetURL() const { 37 const GURL& OmniboxCurrentPageDelegateImpl::GetURL() const {
36 return controller_->GetWebContents()->GetURL(); 38 return controller_->GetWebContents()->GetURL();
37 } 39 }
38 40
39 bool OmniboxCurrentPageDelegateImpl::IsInstantNTP() const { 41 bool OmniboxCurrentPageDelegateImpl::IsInstantNTP() const {
40 return chrome::IsInstantNTP(controller_->GetWebContents()); 42 return chrome::IsInstantNTP(controller_->GetWebContents());
41 } 43 }
42 44
45 bool OmniboxCurrentPageDelegateImpl::IsSearchResultsPage() const {
46 content::WebContents* web_contents = controller_->GetWebContents();
47 Profile* profile =
48 Profile::FromBrowserContext(web_contents->GetBrowserContext());
49 return TemplateURLServiceFactory::GetForProfile(profile)->
50 IsSearchResultsPageFromDefaultSearchProvider(
51 web_contents->GetLastCommittedURL());
Peter Kasting 2013/07/31 23:56:51 It seems wrong that e.g. OmniboxCurrentPageDelegat
rpetterson 2013/08/05 19:46:12 Agreed. They should use the same URL. Done.
52 }
53
43 bool OmniboxCurrentPageDelegateImpl::IsLoading() const { 54 bool OmniboxCurrentPageDelegateImpl::IsLoading() const {
44 return controller_->GetWebContents()->IsLoading(); 55 return controller_->GetWebContents()->IsLoading();
45 } 56 }
46 57
47 content::NavigationController& 58 content::NavigationController&
48 OmniboxCurrentPageDelegateImpl::GetNavigationController() const { 59 OmniboxCurrentPageDelegateImpl::GetNavigationController() const {
49 return controller_->GetWebContents()->GetController(); 60 return controller_->GetWebContents()->GetController();
50 } 61 }
51 62
52 const SessionID& OmniboxCurrentPageDelegateImpl::GetSessionID() const { 63 const SessionID& OmniboxCurrentPageDelegateImpl::GetSessionID() const {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 const AutocompleteMatch& match) { 97 const AutocompleteMatch& match) {
87 content::WebContents* web_contents = controller_->GetWebContents(); 98 content::WebContents* web_contents = controller_->GetWebContents();
88 gfx::Rect container_bounds; 99 gfx::Rect container_bounds;
89 web_contents->GetView()->GetContainerBounds(&container_bounds); 100 web_contents->GetView()->GetContainerBounds(&container_bounds);
90 predictors::AutocompleteActionPredictorFactory::GetForProfile(profile_)-> 101 predictors::AutocompleteActionPredictorFactory::GetForProfile(profile_)->
91 StartPrerendering( 102 StartPrerendering(
92 match.destination_url, 103 match.destination_url,
93 web_contents->GetController().GetSessionStorageNamespaceMap(), 104 web_contents->GetController().GetSessionStorageNamespaceMap(),
94 container_bounds.size()); 105 container_bounds.size());
95 } 106 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698