| OLD | NEW | 
|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stddef.h> | 5 #include <stddef.h> | 
| 6 | 6 | 
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" | 
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" | 
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" | 
| 10 #include "chrome/renderer/plugins/power_saver_info.h" | 10 #include "chrome/renderer/plugins/power_saver_info.h" | 
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 66     } | 66     } | 
| 67   } | 67   } | 
| 68   return std::string(); | 68   return std::string(); | 
| 69 } | 69 } | 
| 70 | 70 | 
| 71 }  // namespace | 71 }  // namespace | 
| 72 | 72 | 
| 73 PowerSaverInfo::PowerSaverInfo() | 73 PowerSaverInfo::PowerSaverInfo() | 
| 74     : power_saver_enabled(false), blocked_for_background_tab(false) {} | 74     : power_saver_enabled(false), blocked_for_background_tab(false) {} | 
| 75 | 75 | 
|  | 76 PowerSaverInfo::PowerSaverInfo(const PowerSaverInfo& other) = default; | 
|  | 77 | 
| 76 PowerSaverInfo PowerSaverInfo::Get(content::RenderFrame* render_frame, | 78 PowerSaverInfo PowerSaverInfo::Get(content::RenderFrame* render_frame, | 
| 77                                    bool power_saver_setting_on, | 79                                    bool power_saver_setting_on, | 
| 78                                    const blink::WebPluginParams& params, | 80                                    const blink::WebPluginParams& params, | 
| 79                                    const content::WebPluginInfo& plugin_info, | 81                                    const content::WebPluginInfo& plugin_info, | 
| 80                                    const GURL& document_url) { | 82                                    const GURL& document_url) { | 
| 81   base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 83   base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 
| 82   std::string override_for_testing = command_line->GetSwitchValueASCII( | 84   std::string override_for_testing = command_line->GetSwitchValueASCII( | 
| 83       switches::kOverridePluginPowerSaverForTesting); | 85       switches::kOverridePluginPowerSaverForTesting); | 
| 84 | 86 | 
| 85   // This feature has only been tested thoroughly with Flash thus far. | 87   // This feature has only been tested thoroughly with Flash thus far. | 
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 117       info.poster_attribute = GetPluginInstancePosterAttribute(params); | 119       info.poster_attribute = GetPluginInstancePosterAttribute(params); | 
| 118       info.base_url = document_url; | 120       info.base_url = document_url; | 
| 119     } | 121     } | 
| 120   } | 122   } | 
| 121 | 123 | 
| 122   if (is_flash) | 124   if (is_flash) | 
| 123     TrackPosterParamPresence(params, info.power_saver_enabled); | 125     TrackPosterParamPresence(params, info.power_saver_enabled); | 
| 124 | 126 | 
| 125   return info; | 127   return info; | 
| 126 } | 128 } | 
| OLD | NEW | 
|---|