| 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/ui/browser.h" | 21 #include "chrome/browser/ui/browser.h" |
| 22 #include "chrome/browser/ui/browser_dialogs.h" | 22 #include "chrome/browser/ui/browser_dialogs.h" |
| 23 #include "chrome/browser/ui/browser_list.h" | 23 #include "chrome/browser/ui/browser_list.h" |
| 24 #include "chrome/browser/ui/webui/web_dialog_delegate.h" | 24 #include "ui/web_dialogs/web_dialog_delegate.h" |
| 25 #include "ui/web_dialogs/web_dialog_ui.h" |
| 25 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| 26 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
| 27 #include "chrome/common/url_constants.h" | 28 #include "chrome/common/url_constants.h" |
| 28 #include "grit/google_chrome_strings.h" | 29 #include "grit/google_chrome_strings.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
| 30 | 31 |
| 31 #if defined(OS_CHROMEOS) | 32 #if defined(OS_CHROMEOS) |
| 32 #include "ui/views/widget/widget.h" | 33 #include "ui/views/widget/widget.h" |
| 33 #endif | 34 #endif |
| 34 | 35 |
| 35 namespace { | 36 namespace { |
| 36 | 37 |
| 37 // The minimum size of task manager window in px. | 38 // The minimum size of task manager window in px. |
| 38 const int kMinimumTaskManagerWidth = 640; | 39 const int kMinimumTaskManagerWidth = 640; |
| 39 const int kMinimumTaskManagerHeight = 480; | 40 const int kMinimumTaskManagerHeight = 480; |
| 40 | 41 |
| 41 } // namespace | 42 } // namespace |
| 42 | 43 |
| 43 using content::BrowserThread; | 44 using content::BrowserThread; |
| 44 using content::WebContents; | 45 using content::WebContents; |
| 45 using content::WebUIMessageHandler; | 46 using content::WebUIMessageHandler; |
| 46 | 47 |
| 47 class TaskManagerDialogImpl : public WebDialogDelegate { | 48 class TaskManagerDialogImpl : public web_dialogs::WebDialogDelegate { |
| 48 public: | 49 public: |
| 49 TaskManagerDialogImpl(); | 50 TaskManagerDialogImpl(); |
| 50 | 51 |
| 51 static void Show(bool is_background_page_mode); | 52 static void Show(bool is_background_page_mode); |
| 52 static TaskManagerDialogImpl* GetInstance(); | 53 static TaskManagerDialogImpl* GetInstance(); |
| 53 | 54 |
| 54 protected: | 55 protected: |
| 55 friend struct DefaultSingletonTraits<TaskManagerDialogImpl>; | 56 friend struct DefaultSingletonTraits<TaskManagerDialogImpl>; |
| 56 virtual ~TaskManagerDialogImpl(); | 57 virtual ~TaskManagerDialogImpl(); |
| 57 | 58 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 BrowserThread::PostTask( | 211 BrowserThread::PostTask( |
| 211 BrowserThread::UI, FROM_HERE, | 212 BrowserThread::UI, FROM_HERE, |
| 212 base::Bind(&TaskManagerDialogImpl::Show, true)); | 213 base::Bind(&TaskManagerDialogImpl::Show, true)); |
| 213 } | 214 } |
| 214 | 215 |
| 215 // static | 216 // static |
| 216 bool TaskManagerDialog::UseWebUITaskManager() { | 217 bool TaskManagerDialog::UseWebUITaskManager() { |
| 217 return CommandLine::ForCurrentProcess()->HasSwitch( | 218 return CommandLine::ForCurrentProcess()->HasSwitch( |
| 218 switches::kWebUITaskManager); | 219 switches::kWebUITaskManager); |
| 219 } | 220 } |
| OLD | NEW |