| 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 "chrome/browser/chromeos/offline/offline_load_page.h" | 5 #include "chrome/browser/chromeos/offline/offline_load_page.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/shell_delegate.h" | 8 #include "ash/shell_delegate.h" |
| 9 #include "ash/system/tray/system_tray_delegate.h" | 9 #include "ash/system/tray/system_tray_delegate.h" |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/string_piece.h" | 12 #include "base/string_piece.h" |
| 13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
| 14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "chrome/browser/chromeos/cros/cros_library.h" | 16 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 17 #include "chrome/browser/chromeos/cros/network_library.h" | 17 #include "chrome/browser/chromeos/cros/network_library.h" |
| 18 #include "chrome/browser/extensions/extension_service.h" | 18 #include "chrome/browser/extensions/extension_service.h" |
| 19 #include "chrome/browser/extensions/extension_system.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/renderer_preferences_util.h" | 21 #include "chrome/browser/renderer_preferences_util.h" |
| 21 #include "chrome/browser/tab_contents/tab_util.h" | 22 #include "chrome/browser/tab_contents/tab_util.h" |
| 22 #include "chrome/common/chrome_notification_types.h" | 23 #include "chrome/common/chrome_notification_types.h" |
| 23 #include "chrome/common/extensions/extension.h" | 24 #include "chrome/common/extensions/extension.h" |
| 24 #include "chrome/common/extensions/extension_constants.h" | 25 #include "chrome/common/extensions/extension_constants.h" |
| 25 #include "chrome/common/extensions/extension_icon_set.h" | 26 #include "chrome/common/extensions/extension_icon_set.h" |
| 26 #include "chrome/common/jstemplate_builder.h" | 27 #include "chrome/common/jstemplate_builder.h" |
| 27 #include "chrome/common/url_constants.h" | 28 #include "chrome/common/url_constants.h" |
| 28 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 string16 failed_url(ASCIIToUTF16(url_.spec())); | 93 string16 failed_url(ASCIIToUTF16(url_.spec())); |
| 93 if (rtl) | 94 if (rtl) |
| 94 base::i18n::WrapStringWithLTRFormatting(&failed_url); | 95 base::i18n::WrapStringWithLTRFormatting(&failed_url); |
| 95 strings.SetString("url", failed_url); | 96 strings.SetString("url", failed_url); |
| 96 | 97 |
| 97 // The offline page for app has icons and slightly different message. | 98 // The offline page for app has icons and slightly different message. |
| 98 Profile* profile = Profile::FromBrowserContext( | 99 Profile* profile = Profile::FromBrowserContext( |
| 99 web_contents_->GetBrowserContext()); | 100 web_contents_->GetBrowserContext()); |
| 100 DCHECK(profile); | 101 DCHECK(profile); |
| 101 const extensions::Extension* extension = NULL; | 102 const extensions::Extension* extension = NULL; |
| 102 ExtensionService* extensions_service = profile->GetExtensionService(); | 103 ExtensionService* extensions_service = |
| 104 extensions::ExtensionSystem::Get(profile)->extension_service(); |
| 103 // Extension service does not exist in test. | 105 // Extension service does not exist in test. |
| 104 if (extensions_service) | 106 if (extensions_service) |
| 105 extension = extensions_service->extensions()->GetHostedAppByURL( | 107 extension = extensions_service->extensions()->GetHostedAppByURL( |
| 106 ExtensionURLInfo(url_)); | 108 ExtensionURLInfo(url_)); |
| 107 | 109 |
| 108 if (extension) | 110 if (extension) |
| 109 GetAppOfflineStrings(extension, failed_url, &strings); | 111 GetAppOfflineStrings(extension, failed_url, &strings); |
| 110 else | 112 else |
| 111 GetNormalOfflineStrings(failed_url, &strings); | 113 GetNormalOfflineStrings(failed_url, &strings); |
| 112 | 114 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 for (size_t i = 0; i < cell_networks.size(); ++i) { | 222 for (size_t i = 0; i < cell_networks.size(); ++i) { |
| 221 chromeos::ActivationState activation_state = | 223 chromeos::ActivationState activation_state = |
| 222 cell_networks[i]->activation_state(); | 224 cell_networks[i]->activation_state(); |
| 223 if (activation_state == ACTIVATION_STATE_ACTIVATED) | 225 if (activation_state == ACTIVATION_STATE_ACTIVATED) |
| 224 return false; | 226 return false; |
| 225 } | 227 } |
| 226 return true; | 228 return true; |
| 227 } | 229 } |
| 228 | 230 |
| 229 } // namespace chromeos | 231 } // namespace chromeos |
| OLD | NEW |