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