| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/common/extensions/chrome_extensions_client.h" | 5 #include "chrome/common/extensions/chrome_extensions_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 enum ChromeChannelForHistogram { | 75 enum ChromeChannelForHistogram { |
| 76 CHANNEL_UNKNOWN, | 76 CHANNEL_UNKNOWN, |
| 77 CHANNEL_CANARY, | 77 CHANNEL_CANARY, |
| 78 CHANNEL_DEV, | 78 CHANNEL_DEV, |
| 79 CHANNEL_BETA, | 79 CHANNEL_BETA, |
| 80 CHANNEL_STABLE, | 80 CHANNEL_STABLE, |
| 81 NUM_CHANNELS_FOR_HISTOGRAM | 81 NUM_CHANNELS_FOR_HISTOGRAM |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 ChromeChannelForHistogram GetChromeChannelForHistogram( | 84 ChromeChannelForHistogram GetChromeChannelForHistogram( |
| 85 chrome::VersionInfo::Channel channel) { | 85 version_info::Channel channel) { |
| 86 switch (channel) { | 86 switch (channel) { |
| 87 case chrome::VersionInfo::CHANNEL_UNKNOWN: | 87 case version_info::Channel::UNKNOWN: |
| 88 return CHANNEL_UNKNOWN; | 88 return CHANNEL_UNKNOWN; |
| 89 case chrome::VersionInfo::CHANNEL_CANARY: | 89 case version_info::Channel::CANARY: |
| 90 return CHANNEL_CANARY; | 90 return CHANNEL_CANARY; |
| 91 case chrome::VersionInfo::CHANNEL_DEV: | 91 case version_info::Channel::DEV: |
| 92 return CHANNEL_DEV; | 92 return CHANNEL_DEV; |
| 93 case chrome::VersionInfo::CHANNEL_BETA: | 93 case version_info::Channel::BETA: |
| 94 return CHANNEL_BETA; | 94 return CHANNEL_BETA; |
| 95 case chrome::VersionInfo::CHANNEL_STABLE: | 95 case version_info::Channel::STABLE: |
| 96 return CHANNEL_STABLE; | 96 return CHANNEL_STABLE; |
| 97 } | 97 } |
| 98 NOTREACHED() << channel; | 98 NOTREACHED() << static_cast<int>(channel); |
| 99 return CHANNEL_UNKNOWN; | 99 return CHANNEL_UNKNOWN; |
| 100 } | 100 } |
| 101 | 101 |
| 102 } // namespace | 102 } // namespace |
| 103 | 103 |
| 104 static base::LazyInstance<ChromeExtensionsClient> g_client = | 104 static base::LazyInstance<ChromeExtensionsClient> g_client = |
| 105 LAZY_INSTANCE_INITIALIZER; | 105 LAZY_INSTANCE_INITIALIZER; |
| 106 | 106 |
| 107 ChromeExtensionsClient::ChromeExtensionsClient() | 107 ChromeExtensionsClient::ChromeExtensionsClient() |
| 108 : chrome_api_permissions_(ChromeAPIPermissions()), | 108 : chrome_api_permissions_(ChromeAPIPermissions()), |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 api->RegisterSchemaResource("tts", IDR_EXTENSION_API_JSON_TTS); | 323 api->RegisterSchemaResource("tts", IDR_EXTENSION_API_JSON_TTS); |
| 324 api->RegisterSchemaResource("types", IDR_EXTENSION_API_JSON_TYPES); | 324 api->RegisterSchemaResource("types", IDR_EXTENSION_API_JSON_TYPES); |
| 325 api->RegisterSchemaResource("types.private", | 325 api->RegisterSchemaResource("types.private", |
| 326 IDR_EXTENSION_API_JSON_TYPES_PRIVATE); | 326 IDR_EXTENSION_API_JSON_TYPES_PRIVATE); |
| 327 api->RegisterSchemaResource("webstore", IDR_EXTENSION_API_JSON_WEBSTORE); | 327 api->RegisterSchemaResource("webstore", IDR_EXTENSION_API_JSON_WEBSTORE); |
| 328 } | 328 } |
| 329 | 329 |
| 330 bool ChromeExtensionsClient::ShouldSuppressFatalErrors() const { | 330 bool ChromeExtensionsClient::ShouldSuppressFatalErrors() const { |
| 331 // Suppress fatal everywhere until the cause of bugs like http://crbug/471599 | 331 // Suppress fatal everywhere until the cause of bugs like http://crbug/471599 |
| 332 // are fixed. This would typically be: | 332 // are fixed. This would typically be: |
| 333 // return GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV; | 333 // return GetCurrentChannel() > version_info::Channel::DEV; |
| 334 return true; | 334 return true; |
| 335 } | 335 } |
| 336 | 336 |
| 337 void ChromeExtensionsClient::RecordDidSuppressFatalError() { | 337 void ChromeExtensionsClient::RecordDidSuppressFatalError() { |
| 338 UMA_HISTOGRAM_ENUMERATION("Extensions.DidSuppressJavaScriptException", | 338 UMA_HISTOGRAM_ENUMERATION("Extensions.DidSuppressJavaScriptException", |
| 339 GetChromeChannelForHistogram(GetCurrentChannel()), | 339 GetChromeChannelForHistogram(GetCurrentChannel()), |
| 340 NUM_CHANNELS_FOR_HISTOGRAM); | 340 NUM_CHANNELS_FOR_HISTOGRAM); |
| 341 } | 341 } |
| 342 | 342 |
| 343 std::string ChromeExtensionsClient::GetWebstoreBaseURL() const { | 343 std::string ChromeExtensionsClient::GetWebstoreBaseURL() const { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 | 402 |
| 403 return image_paths; | 403 return image_paths; |
| 404 } | 404 } |
| 405 | 405 |
| 406 // static | 406 // static |
| 407 ChromeExtensionsClient* ChromeExtensionsClient::GetInstance() { | 407 ChromeExtensionsClient* ChromeExtensionsClient::GetInstance() { |
| 408 return g_client.Pointer(); | 408 return g_client.Pointer(); |
| 409 } | 409 } |
| 410 | 410 |
| 411 } // namespace extensions | 411 } // namespace extensions |
| OLD | NEW |