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 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1392 const BrowserPluginHostMsg_ResizeGuest_Params& resize_guest_params) { | 1392 const BrowserPluginHostMsg_ResizeGuest_Params& resize_guest_params) { |
1393 bool old_auto_size_enabled = auto_size_enabled_; | 1393 bool old_auto_size_enabled = auto_size_enabled_; |
1394 gfx::Size old_max_size = max_auto_size_; | 1394 gfx::Size old_max_size = max_auto_size_; |
1395 gfx::Size old_min_size = min_auto_size_; | 1395 gfx::Size old_min_size = min_auto_size_; |
1396 auto_size_enabled_ = auto_size_params.enable; | 1396 auto_size_enabled_ = auto_size_params.enable; |
1397 max_auto_size_ = auto_size_params.max_size; | 1397 max_auto_size_ = auto_size_params.max_size; |
1398 min_auto_size_ = auto_size_params.min_size; | 1398 min_auto_size_ = auto_size_params.min_size; |
1399 if (auto_size_enabled_ && (!old_auto_size_enabled || | 1399 if (auto_size_enabled_ && (!old_auto_size_enabled || |
1400 (old_max_size != max_auto_size_) || | 1400 (old_max_size != max_auto_size_) || |
1401 (old_min_size != min_auto_size_))) { | 1401 (old_min_size != min_auto_size_))) { |
| 1402 RecordAction(UserMetricsAction("BrowserPlugin.Guest.EnableAutoResize")); |
1402 GetWebContents()->GetRenderViewHost()->EnableAutoResize( | 1403 GetWebContents()->GetRenderViewHost()->EnableAutoResize( |
1403 min_auto_size_, max_auto_size_); | 1404 min_auto_size_, max_auto_size_); |
1404 // TODO(fsamuel): If we're changing autosize parameters, then we force | 1405 // TODO(fsamuel): If we're changing autosize parameters, then we force |
1405 // the guest to completely repaint itself, because BrowserPlugin has | 1406 // the guest to completely repaint itself, because BrowserPlugin has |
1406 // allocated a new damage buffer and expects a full frame of pixels. | 1407 // allocated a new damage buffer and expects a full frame of pixels. |
1407 // Ideally, we shouldn't need to do this because we shouldn't need to | 1408 // Ideally, we shouldn't need to do this because we shouldn't need to |
1408 // allocate a new damage buffer unless |max_auto_size_| has changed. | 1409 // allocate a new damage buffer unless |max_auto_size_| has changed. |
1409 // However, even in that case, layout may not change and so we may | 1410 // However, even in that case, layout may not change and so we may |
1410 // not get a full frame worth of pixels. | 1411 // not get a full frame worth of pixels. |
1411 Send(new ViewMsg_Repaint(routing_id(), max_auto_size_)); | 1412 Send(new ViewMsg_Repaint(routing_id(), max_auto_size_)); |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1686 request_info.Set(browser_plugin::kRequestMethod, | 1687 request_info.Set(browser_plugin::kRequestMethod, |
1687 base::Value::CreateStringValue(request_method)); | 1688 base::Value::CreateStringValue(request_method)); |
1688 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); | 1689 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); |
1689 | 1690 |
1690 RequestPermission(BROWSER_PLUGIN_PERMISSION_TYPE_DOWNLOAD, | 1691 RequestPermission(BROWSER_PLUGIN_PERMISSION_TYPE_DOWNLOAD, |
1691 new DownloadRequest(callback), | 1692 new DownloadRequest(callback), |
1692 request_info); | 1693 request_info); |
1693 } | 1694 } |
1694 | 1695 |
1695 } // namespace content | 1696 } // namespace content |
OLD | NEW |