OLD | NEW |
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 "content/browser/browser_plugin/browser_plugin_guest.h" | 5 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1384 const BrowserPluginHostMsg_ResizeGuest_Params& resize_guest_params) { | 1384 const BrowserPluginHostMsg_ResizeGuest_Params& resize_guest_params) { |
1385 bool old_auto_size_enabled = auto_size_enabled_; | 1385 bool old_auto_size_enabled = auto_size_enabled_; |
1386 gfx::Size old_max_size = max_auto_size_; | 1386 gfx::Size old_max_size = max_auto_size_; |
1387 gfx::Size old_min_size = min_auto_size_; | 1387 gfx::Size old_min_size = min_auto_size_; |
1388 auto_size_enabled_ = auto_size_params.enable; | 1388 auto_size_enabled_ = auto_size_params.enable; |
1389 max_auto_size_ = auto_size_params.max_size; | 1389 max_auto_size_ = auto_size_params.max_size; |
1390 min_auto_size_ = auto_size_params.min_size; | 1390 min_auto_size_ = auto_size_params.min_size; |
1391 if (auto_size_enabled_ && (!old_auto_size_enabled || | 1391 if (auto_size_enabled_ && (!old_auto_size_enabled || |
1392 (old_max_size != max_auto_size_) || | 1392 (old_max_size != max_auto_size_) || |
1393 (old_min_size != min_auto_size_))) { | 1393 (old_min_size != min_auto_size_))) { |
| 1394 RecordAction(UserMetricsAction("BrowserPlugin.Guest.EnableAutoResize")); |
1394 GetWebContents()->GetRenderViewHost()->EnableAutoResize( | 1395 GetWebContents()->GetRenderViewHost()->EnableAutoResize( |
1395 min_auto_size_, max_auto_size_); | 1396 min_auto_size_, max_auto_size_); |
1396 // TODO(fsamuel): If we're changing autosize parameters, then we force | 1397 // TODO(fsamuel): If we're changing autosize parameters, then we force |
1397 // the guest to completely repaint itself, because BrowserPlugin has | 1398 // the guest to completely repaint itself, because BrowserPlugin has |
1398 // allocated a new damage buffer and expects a full frame of pixels. | 1399 // allocated a new damage buffer and expects a full frame of pixels. |
1399 // Ideally, we shouldn't need to do this because we shouldn't need to | 1400 // Ideally, we shouldn't need to do this because we shouldn't need to |
1400 // allocate a new damage buffer unless |max_auto_size_| has changed. | 1401 // allocate a new damage buffer unless |max_auto_size_| has changed. |
1401 // However, even in that case, layout may not change and so we may | 1402 // However, even in that case, layout may not change and so we may |
1402 // not get a full frame worth of pixels. | 1403 // not get a full frame worth of pixels. |
1403 Send(new ViewMsg_Repaint(routing_id(), max_auto_size_)); | 1404 Send(new ViewMsg_Repaint(routing_id(), max_auto_size_)); |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1677 request_info.Set(browser_plugin::kRequestMethod, | 1678 request_info.Set(browser_plugin::kRequestMethod, |
1678 base::Value::CreateStringValue(request_method)); | 1679 base::Value::CreateStringValue(request_method)); |
1679 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); | 1680 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); |
1680 | 1681 |
1681 RequestPermission(BROWSER_PLUGIN_PERMISSION_TYPE_DOWNLOAD, | 1682 RequestPermission(BROWSER_PLUGIN_PERMISSION_TYPE_DOWNLOAD, |
1682 new DownloadRequest(callback), | 1683 new DownloadRequest(callback), |
1683 request_info); | 1684 request_info); |
1684 } | 1685 } |
1685 | 1686 |
1686 } // namespace content | 1687 } // namespace content |
OLD | NEW |