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

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: Rebase 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"
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 SearchBox::SearchBox(content::RenderView* render_view) 14 SearchBox::SearchBox(content::RenderView* render_view)
16 : content::RenderViewObserver(render_view), 15 : content::RenderViewObserver(render_view),
17 content::RenderViewObserverTracker<SearchBox>(render_view), 16 content::RenderViewObserverTracker<SearchBox>(render_view),
18 verbatim_(false), 17 verbatim_(false),
19 selection_start_(0), 18 selection_start_(0),
20 selection_end_(0), 19 selection_end_(0),
21 results_base_(0), 20 results_base_(0),
22 start_margin_(0), 21 start_margin_(0),
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxCancelSelection, 156 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxCancelSelection,
158 OnCancelSelection) 157 OnCancelSelection)
159 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetDisplayInstantResults, 158 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetDisplayInstantResults,
160 OnSetDisplayInstantResults) 159 OnSetDisplayInstantResults)
161 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxKeyCaptureChanged, 160 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxKeyCaptureChanged,
162 OnKeyCaptureChange) 161 OnKeyCaptureChange)
163 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxThemeChanged, 162 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxThemeChanged,
164 OnThemeChanged) 163 OnThemeChanged)
165 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxFontInformation, 164 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxFontInformation,
166 OnFontInformationReceived) 165 OnFontInformationReceived)
167 IPC_MESSAGE_HANDLER(
168 ChromeViewMsg_SearchBoxGrantChromeSearchAccessFromOrigin,
169 OnGrantChromeSearchAccessFromOrigin)
170 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxMostVisitedItemsChanged, 166 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxMostVisitedItemsChanged,
171 OnMostVisitedChanged) 167 OnMostVisitedChanged)
172 IPC_MESSAGE_UNHANDLED(handled = false) 168 IPC_MESSAGE_UNHANDLED(handled = false)
173 IPC_END_MESSAGE_MAP() 169 IPC_END_MESSAGE_MAP()
174 return handled; 170 return handled;
175 } 171 }
176 172
177 void SearchBox::DidClearWindowObject(WebKit::WebFrame* frame) { 173 void SearchBox::DidClearWindowObject(WebKit::WebFrame* frame) {
178 extensions_v8::SearchBoxExtension::DispatchOnWindowReady(frame); 174 extensions_v8::SearchBoxExtension::DispatchOnWindowReady(frame);
179 } 175 }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 render_view()->GetWebView()->mainFrame()); 303 render_view()->GetWebView()->mainFrame());
308 } 304 }
309 } 305 }
310 306
311 void SearchBox::OnFontInformationReceived(const string16& omnibox_font, 307 void SearchBox::OnFontInformationReceived(const string16& omnibox_font,
312 size_t omnibox_font_size) { 308 size_t omnibox_font_size) {
313 omnibox_font_ = omnibox_font; 309 omnibox_font_ = omnibox_font;
314 omnibox_font_size_ = omnibox_font_size; 310 omnibox_font_size_ = omnibox_font_size;
315 } 311 }
316 312
317 void SearchBox::OnGrantChromeSearchAccessFromOrigin(const GURL& origin_url) {
318 string16 chrome_search_scheme(ASCIIToUTF16(chrome::kChromeSearchScheme));
319 WebKit::WebSecurityPolicy::addOriginAccessWhitelistEntry(
320 origin_url,
321 chrome_search_scheme,
322 ASCIIToUTF16(chrome::kChromeUIFaviconHost),
323 false);
324 WebKit::WebSecurityPolicy::addOriginAccessWhitelistEntry(
325 origin_url,
326 chrome_search_scheme,
327 ASCIIToUTF16(chrome::kChromeUIThemeHost),
328 false);
329 WebKit::WebSecurityPolicy::addOriginAccessWhitelistEntry(
330 origin_url,
331 chrome_search_scheme,
332 ASCIIToUTF16(chrome::kChromeUIThumbnailHost),
333 false);
334 }
335
336 double SearchBox::GetZoom() const { 313 double SearchBox::GetZoom() const {
337 WebKit::WebView* web_view = render_view()->GetWebView(); 314 WebKit::WebView* web_view = render_view()->GetWebView();
338 if (web_view) { 315 if (web_view) {
339 double zoom = WebKit::WebView::zoomLevelToZoomFactor(web_view->zoomLevel()); 316 double zoom = WebKit::WebView::zoomLevelToZoomFactor(web_view->zoomLevel());
340 if (zoom != 0) 317 if (zoom != 0)
341 return zoom; 318 return zoom;
342 } 319 }
343 return 1.0; 320 return 1.0;
344 } 321 }
345 322
(...skipping 22 matching lines...) Expand all
368 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { 345 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
369 extensions_v8::SearchBoxExtension::DispatchMostVisitedChanged( 346 extensions_v8::SearchBoxExtension::DispatchMostVisitedChanged(
370 render_view()->GetWebView()->mainFrame()); 347 render_view()->GetWebView()->mainFrame());
371 } 348 }
372 } 349 }
373 350
374 const std::vector<InstantMostVisitedItem>& 351 const std::vector<InstantMostVisitedItem>&
375 SearchBox::GetMostVisitedItems() const { 352 SearchBox::GetMostVisitedItems() const {
376 return most_visited_items_; 353 return most_visited_items_;
377 } 354 }
OLDNEW
« chrome/renderer/chrome_content_renderer_client.cc ('K') | « chrome/renderer/searchbox/searchbox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698