| 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/ui/webui/task_manager/task_manager_dialog.h" | 5 #include "chrome/browser/ui/webui/task_manager/task_manager_dialog.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
| 14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/defaults.h" | 16 #include "chrome/browser/defaults.h" |
| 17 #include "chrome/browser/platform_util.h" | 17 #include "chrome/browser/platform_util.h" |
| 18 #include "chrome/browser/prefs/pref_service.h" | 18 #include "chrome/browser/prefs/pref_service.h" |
| 19 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 19 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/profiles/profile_manager.h" | 21 #include "chrome/browser/profiles/profile_manager.h" |
| 22 #include "chrome/browser/ui/browser_dialogs.h" | 22 #include "chrome/browser/ui/browser_dialogs.h" |
| 23 #include "chrome/browser/ui/webui/web_dialog_delegate.h" | |
| 24 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
| 25 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
| 26 #include "chrome/common/url_constants.h" | 25 #include "chrome/common/url_constants.h" |
| 27 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
| 28 #include "grit/google_chrome_strings.h" | 27 #include "grit/google_chrome_strings.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
| 30 #include "ui/gfx/size.h" | 29 #include "ui/gfx/size.h" |
| 30 #include "ui/web_dialogs/web_dialog_delegate.h" |
| 31 | 31 |
| 32 #if defined(OS_CHROMEOS) | 32 #if defined(OS_CHROMEOS) |
| 33 #include "ui/views/widget/widget.h" | 33 #include "ui/views/widget/widget.h" |
| 34 #endif | 34 #endif |
| 35 | 35 |
| 36 namespace { | 36 namespace { |
| 37 | 37 |
| 38 // The minimum size of task manager window in px. | 38 // The minimum size of task manager window in px. |
| 39 const int kMinimumTaskManagerWidth = 640; | 39 const int kMinimumTaskManagerWidth = 640; |
| 40 const int kMinimumTaskManagerHeight = 480; | 40 const int kMinimumTaskManagerHeight = 480; |
| 41 | 41 |
| 42 } // namespace | 42 } // namespace |
| 43 | 43 |
| 44 using content::BrowserThread; | 44 using content::BrowserThread; |
| 45 using content::WebContents; | 45 using content::WebContents; |
| 46 using content::WebUIMessageHandler; | 46 using content::WebUIMessageHandler; |
| 47 using ui::WebDialogDelegate; |
| 47 | 48 |
| 48 class TaskManagerDialogImpl : public WebDialogDelegate { | 49 class TaskManagerDialogImpl : public WebDialogDelegate { |
| 49 public: | 50 public: |
| 50 TaskManagerDialogImpl(); | 51 TaskManagerDialogImpl(); |
| 51 | 52 |
| 52 static void Show(bool is_background_page_mode); | 53 static void Show(bool is_background_page_mode); |
| 53 static TaskManagerDialogImpl* GetInstance(); | 54 static TaskManagerDialogImpl* GetInstance(); |
| 54 | 55 |
| 55 protected: | 56 protected: |
| 56 friend struct DefaultSingletonTraits<TaskManagerDialogImpl>; | 57 friend struct DefaultSingletonTraits<TaskManagerDialogImpl>; |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 BrowserThread::PostTask( | 212 BrowserThread::PostTask( |
| 212 BrowserThread::UI, FROM_HERE, | 213 BrowserThread::UI, FROM_HERE, |
| 213 base::Bind(&TaskManagerDialogImpl::Show, true)); | 214 base::Bind(&TaskManagerDialogImpl::Show, true)); |
| 214 } | 215 } |
| 215 | 216 |
| 216 // static | 217 // static |
| 217 bool TaskManagerDialog::UseWebUITaskManager() { | 218 bool TaskManagerDialog::UseWebUITaskManager() { |
| 218 return CommandLine::ForCurrentProcess()->HasSwitch( | 219 return CommandLine::ForCurrentProcess()->HasSwitch( |
| 219 switches::kWebUITaskManager); | 220 switches::kWebUITaskManager); |
| 220 } | 221 } |
| OLD | NEW |