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

Side by Side Diff: chrome/browser/guest_view/web_view/web_view_guest.cc

Issue 303423002: Browser Plugin: Remove Zoom (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/guest_view/web_view/web_view_guest.h" 5 #include "chrome/browser/guest_view/web_view/web_view_guest.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 resource_redirect_details->new_url, 562 resource_redirect_details->new_url,
563 is_top_level); 563 is_top_level);
564 break; 564 break;
565 } 565 }
566 default: 566 default:
567 NOTREACHED() << "Unexpected notification sent."; 567 NOTREACHED() << "Unexpected notification sent.";
568 break; 568 break;
569 } 569 }
570 } 570 }
571 571
572 void WebViewGuest::SetZoom(double zoom_factor) {
573 double zoom_level = content::ZoomFactorToZoomLevel(zoom_factor);
574 content::HostZoomMap::SetZoomLevel(guest_web_contents(), zoom_level);
575
576 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
577 args->SetDouble(webview::kOldZoomFactor, current_zoom_factor_);
578 args->SetDouble(webview::kNewZoomFactor, zoom_factor);
579 DispatchEvent(
580 new GuestViewBase::Event(webview::kEventZoomChange, args.Pass()));
581
582 current_zoom_factor_ = zoom_factor;
583 }
584
585 double WebViewGuest::GetZoom() { 572 double WebViewGuest::GetZoom() {
586 return current_zoom_factor_; 573 return current_zoom_factor_;
587 } 574 }
588 575
589 void WebViewGuest::Find( 576 void WebViewGuest::Find(
590 const base::string16& search_text, 577 const base::string16& search_text,
591 const blink::WebFindOptions& options, 578 const blink::WebFindOptions& options,
592 scoped_refptr<extensions::WebviewFindFunction> find_function) { 579 scoped_refptr<extensions::WebviewFindFunction> find_function) {
593 find_helper_.Find(guest_web_contents(), search_text, options, find_function); 580 find_helper_.Find(guest_web_contents(), search_text, options, find_function);
594 } 581 }
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 } 1248 }
1262 1249
1263 void WebViewGuest::SetName(const std::string& name) { 1250 void WebViewGuest::SetName(const std::string& name) {
1264 if (name_ == name) 1251 if (name_ == name)
1265 return; 1252 return;
1266 name_ = name; 1253 name_ = name;
1267 1254
1268 Send(new ChromeViewMsg_SetName(routing_id(), name_)); 1255 Send(new ChromeViewMsg_SetName(routing_id(), name_));
1269 } 1256 }
1270 1257
1258 void WebViewGuest::SetZoom(double zoom_factor) {
1259 double zoom_level = content::ZoomFactorToZoomLevel(zoom_factor);
1260 content::HostZoomMap::SetZoomLevel(guest_web_contents(), zoom_level);
1261
1262 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
1263 args->SetDouble(webview::kOldZoomFactor, current_zoom_factor_);
1264 args->SetDouble(webview::kNewZoomFactor, zoom_factor);
1265 DispatchEvent(
1266 new GuestViewBase::Event(webview::kEventZoomChange, args.Pass()));
1267
1268 current_zoom_factor_ = zoom_factor;
1269 }
1270
1271 void WebViewGuest::Destroy() { 1271 void WebViewGuest::Destroy() {
1272 if (!attached() && GetOpener()) 1272 if (!attached() && GetOpener())
1273 GetOpener()->pending_new_windows_.erase(this); 1273 GetOpener()->pending_new_windows_.erase(this);
1274 DestroyUnattachedWindows(); 1274 DestroyUnattachedWindows();
1275 GuestViewBase::Destroy(); 1275 GuestViewBase::Destroy();
1276 } 1276 }
1277 1277
1278 void WebViewGuest::AddNewContents(content::WebContents* source, 1278 void WebViewGuest::AddNewContents(content::WebContents* source,
1279 content::WebContents* new_contents, 1279 content::WebContents* new_contents,
1280 WindowOpenDisposition disposition, 1280 WindowOpenDisposition disposition,
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 bool allow, 1414 bool allow,
1415 const std::string& user_input) { 1415 const std::string& user_input) {
1416 WebViewGuest* guest = 1416 WebViewGuest* guest =
1417 WebViewGuest::From(embedder_render_process_id(), new_window_instance_id); 1417 WebViewGuest::From(embedder_render_process_id(), new_window_instance_id);
1418 if (!guest) 1418 if (!guest)
1419 return; 1419 return;
1420 1420
1421 if (!allow) 1421 if (!allow)
1422 guest->Destroy(); 1422 guest->Destroy();
1423 } 1423 }
OLDNEW
« no previous file with comments | « chrome/browser/guest_view/web_view/web_view_guest.h ('k') | content/browser/browser_plugin/browser_plugin_embedder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698