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 "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 string16 failed_url(ASCIIToUTF16(url_.spec())); | 92 string16 failed_url(ASCIIToUTF16(url_.spec())); |
93 if (rtl) | 93 if (rtl) |
94 base::i18n::WrapStringWithLTRFormatting(&failed_url); | 94 base::i18n::WrapStringWithLTRFormatting(&failed_url); |
95 strings.SetString("url", failed_url); | 95 strings.SetString("url", failed_url); |
96 | 96 |
97 // The offline page for app has icons and slightly different message. | 97 // The offline page for app has icons and slightly different message. |
98 Profile* profile = Profile::FromBrowserContext( | 98 Profile* profile = Profile::FromBrowserContext( |
99 web_contents_->GetBrowserContext()); | 99 web_contents_->GetBrowserContext()); |
100 DCHECK(profile); | 100 DCHECK(profile); |
101 const Extension* extension = NULL; | 101 const extensions::Extension* extension = NULL; |
102 ExtensionService* extensions_service = profile->GetExtensionService(); | 102 ExtensionService* extensions_service = profile->GetExtensionService(); |
103 // Extension service does not exist in test. | 103 // Extension service does not exist in test. |
104 if (extensions_service) | 104 if (extensions_service) |
105 extension = extensions_service->extensions()->GetHostedAppByURL( | 105 extension = extensions_service->extensions()->GetHostedAppByURL( |
106 ExtensionURLInfo(url_)); | 106 ExtensionURLInfo(url_)); |
107 | 107 |
108 if (extension) | 108 if (extension) |
109 GetAppOfflineStrings(extension, failed_url, &strings); | 109 GetAppOfflineStrings(extension, failed_url, &strings); |
110 else | 110 else |
111 GetNormalOfflineStrings(failed_url, &strings); | 111 GetNormalOfflineStrings(failed_url, &strings); |
(...skipping 19 matching lines...) Expand all Loading... |
131 | 131 |
132 void OfflineLoadPage::OnDontProceed() { | 132 void OfflineLoadPage::OnDontProceed() { |
133 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 133 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
134 // Ignore if it's already proceeded. | 134 // Ignore if it's already proceeded. |
135 if (proceeded_) | 135 if (proceeded_) |
136 return; | 136 return; |
137 NotifyBlockingPageComplete(false); | 137 NotifyBlockingPageComplete(false); |
138 } | 138 } |
139 | 139 |
140 void OfflineLoadPage::GetAppOfflineStrings( | 140 void OfflineLoadPage::GetAppOfflineStrings( |
141 const Extension* app, | 141 const extensions::Extension* app, |
142 const string16& failed_url, | 142 const string16& failed_url, |
143 DictionaryValue* strings) const { | 143 DictionaryValue* strings) const { |
144 strings->SetString("title", app->name()); | 144 strings->SetString("title", app->name()); |
145 | 145 |
146 GURL icon_url = app->GetIconURL(ExtensionIconSet::EXTENSION_ICON_LARGE, | 146 GURL icon_url = app->GetIconURL(ExtensionIconSet::EXTENSION_ICON_LARGE, |
147 ExtensionIconSet::MATCH_BIGGER); | 147 ExtensionIconSet::MATCH_BIGGER); |
148 if (icon_url.is_empty()) { | 148 if (icon_url.is_empty()) { |
149 strings->SetString("display_icon", "none"); | 149 strings->SetString("display_icon", "none"); |
150 strings->SetString("icon", string16()); | 150 strings->SetString("icon", string16()); |
151 } else { | 151 } else { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 for (size_t i = 0; i < cell_networks.size(); ++i) { | 222 for (size_t i = 0; i < cell_networks.size(); ++i) { |
223 chromeos::ActivationState activation_state = | 223 chromeos::ActivationState activation_state = |
224 cell_networks[i]->activation_state(); | 224 cell_networks[i]->activation_state(); |
225 if (activation_state == ACTIVATION_STATE_ACTIVATED) | 225 if (activation_state == ACTIVATION_STATE_ACTIVATED) |
226 return false; | 226 return false; |
227 } | 227 } |
228 return true; | 228 return true; |
229 } | 229 } |
230 | 230 |
231 } // namespace chromeos | 231 } // namespace chromeos |
OLD | NEW |