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

Side by Side Diff: chrome/browser/ui/search/search_tab_helper.cc

Issue 562603002: Move PageTransition from //content/public/common to //ui/base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/ui/search/search_tab_helper.h" 5 #include "chrome/browser/ui/search/search_tab_helper.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 27 matching lines...) Expand all
38 #include "content/public/browser/navigation_controller.h" 38 #include "content/public/browser/navigation_controller.h"
39 #include "content/public/browser/navigation_details.h" 39 #include "content/public/browser/navigation_details.h"
40 #include "content/public/browser/navigation_entry.h" 40 #include "content/public/browser/navigation_entry.h"
41 #include "content/public/browser/navigation_type.h" 41 #include "content/public/browser/navigation_type.h"
42 #include "content/public/browser/notification_service.h" 42 #include "content/public/browser/notification_service.h"
43 #include "content/public/browser/notification_source.h" 43 #include "content/public/browser/notification_source.h"
44 #include "content/public/browser/render_frame_host.h" 44 #include "content/public/browser/render_frame_host.h"
45 #include "content/public/browser/render_process_host.h" 45 #include "content/public/browser/render_process_host.h"
46 #include "content/public/browser/user_metrics.h" 46 #include "content/public/browser/user_metrics.h"
47 #include "content/public/browser/web_contents.h" 47 #include "content/public/browser/web_contents.h"
48 #include "content/public/common/page_transition_types.h"
49 #include "content/public/common/referrer.h" 48 #include "content/public/common/referrer.h"
50 #include "net/base/net_errors.h" 49 #include "net/base/net_errors.h"
51 #include "ui/base/l10n/l10n_util.h" 50 #include "ui/base/l10n/l10n_util.h"
51 #include "ui/base/page_transition_types.h"
52 #include "url/gurl.h" 52 #include "url/gurl.h"
53 53
54 DEFINE_WEB_CONTENTS_USER_DATA_KEY(SearchTabHelper); 54 DEFINE_WEB_CONTENTS_USER_DATA_KEY(SearchTabHelper);
55 55
56 namespace { 56 namespace {
57 57
58 // For reporting Cacheable NTP navigations. 58 // For reporting Cacheable NTP navigations.
59 enum CacheableNTPLoad { 59 enum CacheableNTPLoad {
60 CACHEABLE_NTP_LOAD_FAILED = 0, 60 CACHEABLE_NTP_LOAD_FAILED = 0,
61 CACHEABLE_NTP_LOAD_SUCCEEDED = 1, 61 CACHEABLE_NTP_LOAD_SUCCEEDED = 1,
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 613
614 Profile* SearchTabHelper::profile() const { 614 Profile* SearchTabHelper::profile() const {
615 return Profile::FromBrowserContext(web_contents_->GetBrowserContext()); 615 return Profile::FromBrowserContext(web_contents_->GetBrowserContext());
616 } 616 }
617 617
618 void SearchTabHelper::RedirectToLocalNTP() { 618 void SearchTabHelper::RedirectToLocalNTP() {
619 // Extra parentheses to declare a variable. 619 // Extra parentheses to declare a variable.
620 content::NavigationController::LoadURLParams load_params( 620 content::NavigationController::LoadURLParams load_params(
621 (GURL(chrome::kChromeSearchLocalNtpUrl))); 621 (GURL(chrome::kChromeSearchLocalNtpUrl)));
622 load_params.referrer = content::Referrer(); 622 load_params.referrer = content::Referrer();
623 load_params.transition_type = content::PAGE_TRANSITION_SERVER_REDIRECT; 623 load_params.transition_type = ui::PAGE_TRANSITION_SERVER_REDIRECT;
624 // Don't push a history entry. 624 // Don't push a history entry.
625 load_params.should_replace_current_entry = true; 625 load_params.should_replace_current_entry = true;
626 web_contents_->GetController().LoadURLWithParams(load_params); 626 web_contents_->GetController().LoadURLWithParams(load_params);
627 } 627 }
628 628
629 bool SearchTabHelper::IsInputInProgress() const { 629 bool SearchTabHelper::IsInputInProgress() const {
630 OmniboxView* omnibox = GetOmniboxView(); 630 OmniboxView* omnibox = GetOmniboxView();
631 return !model_.mode().is_ntp() && omnibox && 631 return !model_.mode().is_ntp() && omnibox &&
632 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; 632 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE;
633 } 633 }
634 634
635 OmniboxView* SearchTabHelper::GetOmniboxView() const { 635 OmniboxView* SearchTabHelper::GetOmniboxView() const {
636 return delegate_ ? delegate_->GetOmniboxView() : NULL; 636 return delegate_ ? delegate_->GetOmniboxView() : NULL;
637 } 637 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698