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

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: responding to comments 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 Profile* profile = Profile::FromBrowserContext(
47 controller_->GetWebContents()->GetBrowserContext());
48 return TemplateURLServiceFactory::GetForProfile(profile)->
49 IsSearchResultsPageFromDefaultSearchProvider(GetURL());
50 }
51
43 bool OmniboxCurrentPageDelegateImpl::IsLoading() const { 52 bool OmniboxCurrentPageDelegateImpl::IsLoading() const {
44 return controller_->GetWebContents()->IsLoading(); 53 return controller_->GetWebContents()->IsLoading();
45 } 54 }
46 55
47 content::NavigationController& 56 content::NavigationController&
48 OmniboxCurrentPageDelegateImpl::GetNavigationController() const { 57 OmniboxCurrentPageDelegateImpl::GetNavigationController() const {
49 return controller_->GetWebContents()->GetController(); 58 return controller_->GetWebContents()->GetController();
50 } 59 }
51 60
52 const SessionID& OmniboxCurrentPageDelegateImpl::GetSessionID() const { 61 const SessionID& OmniboxCurrentPageDelegateImpl::GetSessionID() const {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 const AutocompleteMatch& match) { 95 const AutocompleteMatch& match) {
87 content::WebContents* web_contents = controller_->GetWebContents(); 96 content::WebContents* web_contents = controller_->GetWebContents();
88 gfx::Rect container_bounds; 97 gfx::Rect container_bounds;
89 web_contents->GetView()->GetContainerBounds(&container_bounds); 98 web_contents->GetView()->GetContainerBounds(&container_bounds);
90 predictors::AutocompleteActionPredictorFactory::GetForProfile(profile_)-> 99 predictors::AutocompleteActionPredictorFactory::GetForProfile(profile_)->
91 StartPrerendering( 100 StartPrerendering(
92 match.destination_url, 101 match.destination_url,
93 web_contents->GetController().GetSessionStorageNamespaceMap(), 102 web_contents->GetController().GetSessionStorageNamespaceMap(),
94 container_bounds.size()); 103 container_bounds.size());
95 } 104 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698