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

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

Issue 11369137: Implement {Start,Stop}CapturingKeyStrokes for Instant. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix which active tab we use. Created 8 years, 1 month 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/ui/search/search_tab_helper.h" 5 #include "chrome/browser/ui/search/search_tab_helper.h"
6 6
7 #include "chrome/browser/google/google_util.h" 7 #include "chrome/browser/google/google_util.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/search/search.h" 9 #include "chrome/browser/ui/search/search.h"
10 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 return; 77 return;
78 78
79 // Do not animate if this url is the very first navigation for the tab. 79 // Do not animate if this url is the very first navigation for the tab.
80 // NTP mode changes are initiated at "pending", all others are initiated 80 // NTP mode changes are initiated at "pending", all others are initiated
81 // when "committed". This is because NTP is rendered natively so is faster 81 // when "committed". This is because NTP is rendered natively so is faster
82 // to render than the web contents and we need to coordinate the animations. 82 // to render than the web contents and we need to coordinate the animations.
83 if (IsNTP(url)) 83 if (IsNTP(url))
84 UpdateModelBasedOnURL(url, !is_initial_navigation_commit_); 84 UpdateModelBasedOnURL(url, !is_initial_navigation_commit_);
85 } 85 }
86 86
87 void SearchTabHelper::OnWebSearchBoxFocus() {
88 if (model_.mode().is_ntp())
89 model_.SetMode(Mode(Mode::MODE_NTP_WEB_SEARCHBOX_HAS_FOCUS, false));
Mathieu 2012/11/15 20:37:20 I think this is missing the origin parameter (2nd
90 }
91
92 void SearchTabHelper::OnWebSearchBoxBlur() {
93 if (model_.mode().is_ntp())
94 model_.SetMode(Mode(Mode::MODE_NTP, false));
95 }
96
87 void SearchTabHelper::Observe( 97 void SearchTabHelper::Observe(
88 int type, 98 int type,
89 const content::NotificationSource& source, 99 const content::NotificationSource& source,
90 const content::NotificationDetails& details) { 100 const content::NotificationDetails& details) {
91 DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_COMMITTED, type); 101 DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_COMMITTED, type);
92 content::LoadCommittedDetails* committed_details = 102 content::LoadCommittedDetails* committed_details =
93 content::Details<content::LoadCommittedDetails>(details).ptr(); 103 content::Details<content::LoadCommittedDetails>(details).ptr();
94 // See comment in |NavigateToPendingEntry()| about why |!IsNTP()| is used. 104 // See comment in |NavigateToPendingEntry()| about why |!IsNTP()| is used.
95 if (!IsNTP(committed_details->entry->GetURL())) { 105 if (!IsNTP(committed_details->entry->GetURL())) {
96 UpdateModelBasedOnURL(committed_details->entry->GetURL(), 106 UpdateModelBasedOnURL(committed_details->entry->GetURL(),
(...skipping 10 matching lines...) Expand all
107 type = Mode::MODE_SEARCH_RESULTS; 117 type = Mode::MODE_SEARCH_RESULTS;
108 model_.SetMode(Mode(type, animate)); 118 model_.SetMode(Mode(type, animate));
109 } 119 }
110 120
111 const content::WebContents* SearchTabHelper::web_contents() const { 121 const content::WebContents* SearchTabHelper::web_contents() const {
112 return model_.web_contents(); 122 return model_.web_contents();
113 } 123 }
114 124
115 } // namespace search 125 } // namespace search
116 } // namespace chrome 126 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698