| 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" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 #include "net/base/net_errors.h" | 41 #include "net/base/net_errors.h" |
| 42 #include "ui/base/l10n/l10n_util.h" | 42 #include "ui/base/l10n/l10n_util.h" |
| 43 #include "ui/base/resource/resource_bundle.h" | 43 #include "ui/base/resource/resource_bundle.h" |
| 44 #include "ui/base/webui/jstemplate_builder.h" | 44 #include "ui/base/webui/jstemplate_builder.h" |
| 45 #include "ui/base/webui/web_ui_util.h" | 45 #include "ui/base/webui/web_ui_util.h" |
| 46 | 46 |
| 47 using content::BrowserThread; | 47 using content::BrowserThread; |
| 48 using content::InterstitialPage; | 48 using content::InterstitialPage; |
| 49 using content::WebContents; | 49 using content::WebContents; |
| 50 | 50 |
| 51 namespace { | |
| 52 | |
| 53 // A utility function to set the dictionary's value given by |resource_id|. | |
| 54 void SetString(DictionaryValue* strings, const char* name, int resource_id) { | |
| 55 strings->SetString(name, l10n_util::GetStringUTF16(resource_id)); | |
| 56 } | |
| 57 | |
| 58 } // namespace | |
| 59 | |
| 60 namespace chromeos { | 51 namespace chromeos { |
| 61 | 52 |
| 62 OfflineLoadPage::OfflineLoadPage(WebContents* web_contents, | 53 OfflineLoadPage::OfflineLoadPage(WebContents* web_contents, |
| 63 const GURL& url, | 54 const GURL& url, |
| 64 const CompletionCallback& callback) | 55 const CompletionCallback& callback) |
| 65 : callback_(callback), | 56 : callback_(callback), |
| 66 proceeded_(false), | 57 proceeded_(false), |
| 67 web_contents_(web_contents), | 58 web_contents_(web_contents), |
| 68 url_(url) { | 59 url_(url) { |
| 69 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); | 60 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 const bool online = type != net::NetworkChangeNotifier::CONNECTION_NONE; | 153 const bool online = type != net::NetworkChangeNotifier::CONNECTION_NONE; |
| 163 DVLOG(1) << "ConnectionTypeObserver notification received: state=" | 154 DVLOG(1) << "ConnectionTypeObserver notification received: state=" |
| 164 << (online ? "online" : "offline"); | 155 << (online ? "online" : "offline"); |
| 165 if (online) { | 156 if (online) { |
| 166 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); | 157 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); |
| 167 interstitial_page_->Proceed(); | 158 interstitial_page_->Proceed(); |
| 168 } | 159 } |
| 169 } | 160 } |
| 170 | 161 |
| 171 } // namespace chromeos | 162 } // namespace chromeos |
| OLD | NEW |