| 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/accessibility/browser_accessibility_state_impl.h" | 5 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "content/browser/accessibility/accessibility_mode_helper.h" | 9 #include "content/browser/accessibility/accessibility_mode_helper.h" |
| 10 #include "content/browser/renderer_host/render_widget_host_impl.h" | 10 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 11 #include "content/browser/web_contents/web_contents_impl.h" | 11 #include "content/browser/web_contents/web_contents_impl.h" |
| 12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 13 #include "content/public/common/content_switches.h" | 13 #include "content/public/common/content_switches.h" |
| 14 #include "ui/gfx/sys_color_change_listener.h" | 14 #include "ui/gfx/color_utils.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 | 17 |
| 18 // Update the accessibility histogram 45 seconds after initialization. | 18 // Update the accessibility histogram 45 seconds after initialization. |
| 19 static const int kAccessibilityHistogramDelaySecs = 45; | 19 static const int kAccessibilityHistogramDelaySecs = 45; |
| 20 | 20 |
| 21 // static | 21 // static |
| 22 BrowserAccessibilityState* BrowserAccessibilityState::GetInstance() { | 22 BrowserAccessibilityState* BrowserAccessibilityState::GetInstance() { |
| 23 return BrowserAccessibilityStateImpl::GetInstance(); | 23 return BrowserAccessibilityStateImpl::GetInstance(); |
| 24 } | 24 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 } | 105 } |
| 106 | 106 |
| 107 void BrowserAccessibilityStateImpl::UpdateHistograms() { | 107 void BrowserAccessibilityStateImpl::UpdateHistograms() { |
| 108 UpdatePlatformSpecificHistograms(); | 108 UpdatePlatformSpecificHistograms(); |
| 109 | 109 |
| 110 for (size_t i = 0; i < histogram_callbacks_.size(); ++i) | 110 for (size_t i = 0; i < histogram_callbacks_.size(); ++i) |
| 111 histogram_callbacks_[i].Run(); | 111 histogram_callbacks_[i].Run(); |
| 112 | 112 |
| 113 UMA_HISTOGRAM_BOOLEAN("Accessibility.State", IsAccessibleBrowser()); | 113 UMA_HISTOGRAM_BOOLEAN("Accessibility.State", IsAccessibleBrowser()); |
| 114 UMA_HISTOGRAM_BOOLEAN("Accessibility.InvertedColors", | 114 UMA_HISTOGRAM_BOOLEAN("Accessibility.InvertedColors", |
| 115 gfx::IsInvertedColorScheme()); | 115 color_utils::IsInvertedColorScheme()); |
| 116 UMA_HISTOGRAM_BOOLEAN("Accessibility.ManuallyEnabled", | 116 UMA_HISTOGRAM_BOOLEAN("Accessibility.ManuallyEnabled", |
| 117 base::CommandLine::ForCurrentProcess()->HasSwitch( | 117 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 118 switches::kForceRendererAccessibility)); | 118 switches::kForceRendererAccessibility)); |
| 119 } | 119 } |
| 120 | 120 |
| 121 #if !defined(OS_WIN) | 121 #if !defined(OS_WIN) |
| 122 void BrowserAccessibilityStateImpl::UpdatePlatformSpecificHistograms() { | 122 void BrowserAccessibilityStateImpl::UpdatePlatformSpecificHistograms() { |
| 123 } | 123 } |
| 124 #endif | 124 #endif |
| 125 | 125 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 WebContentsImpl::GetAllWebContents(); | 157 WebContentsImpl::GetAllWebContents(); |
| 158 for (size_t i = 0; i < web_contents_vector.size(); ++i) { | 158 for (size_t i = 0; i < web_contents_vector.size(); ++i) { |
| 159 if (add) | 159 if (add) |
| 160 web_contents_vector[i]->AddAccessibilityMode(mode); | 160 web_contents_vector[i]->AddAccessibilityMode(mode); |
| 161 else | 161 else |
| 162 web_contents_vector[i]->RemoveAccessibilityMode(mode); | 162 web_contents_vector[i]->RemoveAccessibilityMode(mode); |
| 163 } | 163 } |
| 164 } | 164 } |
| 165 | 165 |
| 166 } // namespace content | 166 } // namespace content |
| OLD | NEW |