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

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

Issue 12621008: chrome-search: should not be display-isolated (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased to HEAD 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
« no previous file with comments | « chrome/renderer/searchbox/searchbox.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "content/public/renderer/render_view.h" 11 #include "content/public/renderer/render_view.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
14 13
15 namespace { 14 namespace {
16 // Size of the results cache. 15 // Size of the results cache.
17 const size_t kMaxInstantAutocompleteResultItemCacheSize = 100; 16 const size_t kMaxInstantAutocompleteResultItemCacheSize = 100;
18 } 17 }
19 18
20 SearchBox::SearchBox(content::RenderView* render_view) 19 SearchBox::SearchBox(content::RenderView* render_view)
21 : content::RenderViewObserver(render_view), 20 : content::RenderViewObserver(render_view),
22 content::RenderViewObserverTracker<SearchBox>(render_view), 21 content::RenderViewObserverTracker<SearchBox>(render_view),
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxCancelSelection, 155 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxCancelSelection,
157 OnCancelSelection) 156 OnCancelSelection)
158 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetDisplayInstantResults, 157 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetDisplayInstantResults,
159 OnSetDisplayInstantResults) 158 OnSetDisplayInstantResults)
160 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxKeyCaptureChanged, 159 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxKeyCaptureChanged,
161 OnKeyCaptureChange) 160 OnKeyCaptureChange)
162 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxThemeChanged, 161 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxThemeChanged,
163 OnThemeChanged) 162 OnThemeChanged)
164 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxFontInformation, 163 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxFontInformation,
165 OnFontInformationReceived) 164 OnFontInformationReceived)
166 IPC_MESSAGE_HANDLER(
167 ChromeViewMsg_SearchBoxGrantChromeSearchAccessFromOrigin,
168 OnGrantChromeSearchAccessFromOrigin)
169 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxMostVisitedItemsChanged, 165 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxMostVisitedItemsChanged,
170 OnMostVisitedChanged) 166 OnMostVisitedChanged)
171 IPC_MESSAGE_UNHANDLED(handled = false) 167 IPC_MESSAGE_UNHANDLED(handled = false)
172 IPC_END_MESSAGE_MAP() 168 IPC_END_MESSAGE_MAP()
173 return handled; 169 return handled;
174 } 170 }
175 171
176 void SearchBox::DidClearWindowObject(WebKit::WebFrame* frame) { 172 void SearchBox::DidClearWindowObject(WebKit::WebFrame* frame) {
177 extensions_v8::SearchBoxExtension::DispatchOnWindowReady(frame); 173 extensions_v8::SearchBoxExtension::DispatchOnWindowReady(frame);
178 } 174 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 render_view()->GetWebView()->mainFrame()); 301 render_view()->GetWebView()->mainFrame());
306 } 302 }
307 } 303 }
308 304
309 void SearchBox::OnFontInformationReceived(const string16& omnibox_font, 305 void SearchBox::OnFontInformationReceived(const string16& omnibox_font,
310 size_t omnibox_font_size) { 306 size_t omnibox_font_size) {
311 omnibox_font_ = omnibox_font; 307 omnibox_font_ = omnibox_font;
312 omnibox_font_size_ = omnibox_font_size; 308 omnibox_font_size_ = omnibox_font_size;
313 } 309 }
314 310
315 void SearchBox::OnGrantChromeSearchAccessFromOrigin(const GURL& origin_url) {
316 string16 chrome_search_scheme(ASCIIToUTF16(chrome::kChromeSearchScheme));
317 WebKit::WebSecurityPolicy::addOriginAccessWhitelistEntry(
318 origin_url,
319 chrome_search_scheme,
320 ASCIIToUTF16(chrome::kChromeUIFaviconHost),
321 false);
322 WebKit::WebSecurityPolicy::addOriginAccessWhitelistEntry(
323 origin_url,
324 chrome_search_scheme,
325 ASCIIToUTF16(chrome::kChromeUIThemeHost),
326 false);
327 WebKit::WebSecurityPolicy::addOriginAccessWhitelistEntry(
328 origin_url,
329 chrome_search_scheme,
330 ASCIIToUTF16(chrome::kChromeUIThumbnailHost),
331 false);
332 }
333
334 double SearchBox::GetZoom() const { 311 double SearchBox::GetZoom() const {
335 WebKit::WebView* web_view = render_view()->GetWebView(); 312 WebKit::WebView* web_view = render_view()->GetWebView();
336 if (web_view) { 313 if (web_view) {
337 double zoom = WebKit::WebView::zoomLevelToZoomFactor(web_view->zoomLevel()); 314 double zoom = WebKit::WebView::zoomLevelToZoomFactor(web_view->zoomLevel());
338 if (zoom != 0) 315 if (zoom != 0)
339 return zoom; 316 return zoom;
340 } 317 }
341 return 1.0; 318 return 1.0;
342 } 319 }
343 320
(...skipping 27 matching lines...) Expand all
371 std::vector<InstantMostVisitedItemIDPair>* items) const { 348 std::vector<InstantMostVisitedItemIDPair>* items) const {
372 return most_visited_items_cache_.GetCurrentItems(items); 349 return most_visited_items_cache_.GetCurrentItems(items);
373 } 350 }
374 351
375 bool SearchBox::GetMostVisitedItemWithID( 352 bool SearchBox::GetMostVisitedItemWithID(
376 InstantRestrictedID most_visited_item_id, 353 InstantRestrictedID most_visited_item_id,
377 InstantMostVisitedItem* item) const { 354 InstantMostVisitedItem* item) const {
378 return most_visited_items_cache_.GetItemWithRestrictedID(most_visited_item_id, 355 return most_visited_items_cache_.GetItemWithRestrictedID(most_visited_item_id,
379 item); 356 item);
380 } 357 }
OLDNEW
« no previous file with comments | « chrome/renderer/searchbox/searchbox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698