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

Side by Side Diff: chrome/renderer/searchbox/searchbox.cc

Issue 12631008: alternate ntp: implement Show/HideBars API to reduce jank when showing/hiding bars (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert obsolete changes in search.h/cc Created 7 years, 9 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 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/renderer/searchbox/searchbox.h" 5 #include "chrome/renderer/searchbox/searchbox.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/common/render_messages.h" 8 #include "chrome/common/render_messages.h"
9 #include "chrome/common/url_constants.h" 9 #include "chrome/common/url_constants.h"
10 #include "chrome/renderer/searchbox/searchbox_extension.h" 10 #include "chrome/renderer/searchbox/searchbox_extension.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 render_view()->Send(new ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion( 82 render_view()->Send(new ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion(
83 render_view()->GetRoutingID(), most_visited_item_id)); 83 render_view()->GetRoutingID(), most_visited_item_id));
84 } 84 }
85 85
86 void SearchBox::UndoAllMostVisitedDeletions() { 86 void SearchBox::UndoAllMostVisitedDeletions() {
87 render_view()->Send( 87 render_view()->Send(
88 new ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions( 88 new ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions(
89 render_view()->GetRoutingID())); 89 render_view()->GetRoutingID()));
90 } 90 }
91 91
92 void SearchBox::ShowBars() {
93 DVLOG(1) << render_view() << " ShowBars";
94 render_view()->Send(new ChromeViewHostMsg_SearchBoxShowBars(
95 render_view()->GetRoutingID(), render_view()->GetPageId()));
96 }
97
98 void SearchBox::HideBars() {
99 DVLOG(1) << render_view() << " HideBars";
100 render_view()->Send(new ChromeViewHostMsg_SearchBoxHideBars(
101 render_view()->GetRoutingID(), render_view()->GetPageId()));
102 }
103
92 int SearchBox::GetStartMargin() const { 104 int SearchBox::GetStartMargin() const {
93 return static_cast<int>(start_margin_ / GetZoom()); 105 return static_cast<int>(start_margin_ / GetZoom());
94 } 106 }
95 107
96 gfx::Rect SearchBox::GetPopupBounds() const { 108 gfx::Rect SearchBox::GetPopupBounds() const {
97 double zoom = GetZoom(); 109 double zoom = GetZoom();
98 return gfx::Rect(static_cast<int>(popup_bounds_.x() / zoom), 110 return gfx::Rect(static_cast<int>(popup_bounds_.x() / zoom),
99 static_cast<int>(popup_bounds_.y() / zoom), 111 static_cast<int>(popup_bounds_.y() / zoom),
100 static_cast<int>(popup_bounds_.width() / zoom), 112 static_cast<int>(popup_bounds_.width() / zoom),
101 static_cast<int>(popup_bounds_.height() / zoom)); 113 static_cast<int>(popup_bounds_.height() / zoom));
(...skipping 24 matching lines...) Expand all
126 } 138 }
127 139
128 bool SearchBox::OnMessageReceived(const IPC::Message& message) { 140 bool SearchBox::OnMessageReceived(const IPC::Message& message) {
129 bool handled = true; 141 bool handled = true;
130 IPC_BEGIN_MESSAGE_MAP(SearchBox, message) 142 IPC_BEGIN_MESSAGE_MAP(SearchBox, message)
131 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxChange, OnChange) 143 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxChange, OnChange)
132 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSubmit, OnSubmit) 144 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSubmit, OnSubmit)
133 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxCancel, OnCancel) 145 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxCancel, OnCancel)
134 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxPopupResize, OnPopupResize) 146 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxPopupResize, OnPopupResize)
135 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxMarginChange, OnMarginChange) 147 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxMarginChange, OnMarginChange)
148 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxBarsHidden, OnBarsHidden)
136 IPC_MESSAGE_HANDLER(ChromeViewMsg_DetermineIfPageSupportsInstant, 149 IPC_MESSAGE_HANDLER(ChromeViewMsg_DetermineIfPageSupportsInstant,
137 OnDetermineIfPageSupportsInstant) 150 OnDetermineIfPageSupportsInstant)
138 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxAutocompleteResults, 151 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxAutocompleteResults,
139 OnAutocompleteResults) 152 OnAutocompleteResults)
140 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxUpOrDownKeyPressed, 153 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxUpOrDownKeyPressed,
141 OnUpOrDownKeyPressed) 154 OnUpOrDownKeyPressed)
142 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxCancelSelection, 155 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxCancelSelection,
143 OnCancelSelection) 156 OnCancelSelection)
144 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetDisplayInstantResults, 157 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetDisplayInstantResults,
145 OnSetDisplayInstantResults) 158 OnSetDisplayInstantResults)
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 229
217 // Override only the width parameter of the popup bounds. 230 // Override only the width parameter of the popup bounds.
218 popup_bounds_.set_width(width); 231 popup_bounds_.set_width(width);
219 232
220 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { 233 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
221 extensions_v8::SearchBoxExtension::DispatchMarginChange( 234 extensions_v8::SearchBoxExtension::DispatchMarginChange(
222 render_view()->GetWebView()->mainFrame()); 235 render_view()->GetWebView()->mainFrame());
223 } 236 }
224 } 237 }
225 238
239 void SearchBox::OnBarsHidden() {
240 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
241 extensions_v8::SearchBoxExtension::DispatchBarsHidden(
242 render_view()->GetWebView()->mainFrame());
243 }
244 }
245
226 void SearchBox::OnDetermineIfPageSupportsInstant() { 246 void SearchBox::OnDetermineIfPageSupportsInstant() {
227 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { 247 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
228 bool result = extensions_v8::SearchBoxExtension::PageSupportsInstant( 248 bool result = extensions_v8::SearchBoxExtension::PageSupportsInstant(
229 render_view()->GetWebView()->mainFrame()); 249 render_view()->GetWebView()->mainFrame());
230 DVLOG(1) << render_view() << " PageSupportsInstant: " << result; 250 DVLOG(1) << render_view() << " PageSupportsInstant: " << result;
231 render_view()->Send(new ChromeViewHostMsg_InstantSupportDetermined( 251 render_view()->Send(new ChromeViewHostMsg_InstantSupportDetermined(
232 render_view()->GetRoutingID(), render_view()->GetPageId(), result)); 252 render_view()->GetRoutingID(), render_view()->GetPageId(), result));
233 } 253 }
234 } 254 }
235 255
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { 366 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
347 extensions_v8::SearchBoxExtension::DispatchMostVisitedChanged( 367 extensions_v8::SearchBoxExtension::DispatchMostVisitedChanged(
348 render_view()->GetWebView()->mainFrame()); 368 render_view()->GetWebView()->mainFrame());
349 } 369 }
350 } 370 }
351 371
352 const std::vector<InstantMostVisitedItem>& 372 const std::vector<InstantMostVisitedItem>&
353 SearchBox::GetMostVisitedItems() const { 373 SearchBox::GetMostVisitedItems() const {
354 return most_visited_items_; 374 return most_visited_items_;
355 } 375 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698