| 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/browser/ui/webui/chromeos/slow_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/slow_ui.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/prefs/pref_change_registrar.h" | 10 #include "base/prefs/pref_change_registrar.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 source->SetJsonPath("strings.js"); | 50 source->SetJsonPath("strings.js"); |
| 51 source->AddResourcePath("slow.js", IDR_SLOW_JS); | 51 source->AddResourcePath("slow.js", IDR_SLOW_JS); |
| 52 source->SetDefaultResource(IDR_SLOW_HTML); | 52 source->SetDefaultResource(IDR_SLOW_HTML); |
| 53 return source; | 53 return source; |
| 54 } | 54 } |
| 55 | 55 |
| 56 // The handler for Javascript messages related to the "slow" view. | 56 // The handler for Javascript messages related to the "slow" view. |
| 57 class SlowHandler : public WebUIMessageHandler { | 57 class SlowHandler : public WebUIMessageHandler { |
| 58 public: | 58 public: |
| 59 explicit SlowHandler(Profile* profile); | 59 explicit SlowHandler(Profile* profile); |
| 60 virtual ~SlowHandler(); | 60 ~SlowHandler() override; |
| 61 | 61 |
| 62 // WebUIMessageHandler implementation. | 62 // WebUIMessageHandler implementation. |
| 63 virtual void RegisterMessages() override; | 63 void RegisterMessages() override; |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 void UpdatePage(); | 66 void UpdatePage(); |
| 67 | 67 |
| 68 // Handlers for JS WebUI messages. | 68 // Handlers for JS WebUI messages. |
| 69 void HandleDisable(const base::ListValue* args); | 69 void HandleDisable(const base::ListValue* args); |
| 70 void HandleEnable(const base::ListValue* args); | 70 void HandleEnable(const base::ListValue* args); |
| 71 void LoadComplete(const base::ListValue* args); | 71 void LoadComplete(const base::ListValue* args); |
| 72 | 72 |
| 73 Profile* profile_; | 73 Profile* profile_; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 SlowHandler* handler = new SlowHandler(profile); | 128 SlowHandler* handler = new SlowHandler(profile); |
| 129 web_ui->AddMessageHandler(handler); | 129 web_ui->AddMessageHandler(handler); |
| 130 | 130 |
| 131 // Set up the chrome://slow/ source. | 131 // Set up the chrome://slow/ source. |
| 132 content::WebUIDataSource::Add(profile, CreateSlowUIHTMLSource()); | 132 content::WebUIDataSource::Add(profile, CreateSlowUIHTMLSource()); |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace chromeos | 135 } // namespace chromeos |
| 136 | 136 |
| OLD | NEW |