Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: chrome/browser/ui/webui/task_manager/task_manager_dialog.cc

Issue 10332297: Make WebUI Task Manager use ShowWebDialog directly rather than calling it with a Browser/use Browse… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/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/browser_list.h"
24 #include "chrome/browser/ui/webui/web_dialog_delegate.h" 23 #include "chrome/browser/ui/webui/web_dialog_delegate.h"
25 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
26 #include "chrome/common/pref_names.h" 25 #include "chrome/common/pref_names.h"
27 #include "chrome/common/url_constants.h" 26 #include "chrome/common/url_constants.h"
27 #include "content/public/browser/browser_thread.h"
28 #include "grit/google_chrome_strings.h" 28 #include "grit/google_chrome_strings.h"
29 #include "ui/base/l10n/l10n_util.h" 29 #include "ui/base/l10n/l10n_util.h"
30 30
31 #if defined(OS_CHROMEOS) 31 #if defined(OS_CHROMEOS)
32 #include "ui/views/widget/widget.h" 32 #include "ui/views/widget/widget.h"
33 #endif 33 #endif
34 34
35 namespace { 35 namespace {
36 36
37 // The minimum size of task manager window in px. 37 // The minimum size of task manager window in px.
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 OpenWebDialog(); 185 OpenWebDialog();
186 ++show_count_; 186 ++show_count_;
187 } 187 }
188 188
189 void TaskManagerDialogImpl::OnCloseDialog() { 189 void TaskManagerDialogImpl::OnCloseDialog() {
190 if (show_count_ > 0) 190 if (show_count_ > 0)
191 --show_count_; 191 --show_count_;
192 } 192 }
193 193
194 void TaskManagerDialogImpl::OpenWebDialog() { 194 void TaskManagerDialogImpl::OpenWebDialog() {
195 Browser* browser = BrowserList::GetLastActive(); 195 window_ = browser::ShowWebDialog(NULL,
196 DCHECK(browser); 196 ProfileManager::GetDefaultProfile(),
197 window_ = browser::ShowWebDialog( 197 NULL,
198 NULL, browser->profile()->GetOriginalProfile(), NULL, this); 198 this);
199 } 199 }
200 200
201 // static 201 // static
202 void TaskManagerDialog::Show() { 202 void TaskManagerDialog::Show() {
203 BrowserThread::PostTask( 203 BrowserThread::PostTask(
204 BrowserThread::UI, FROM_HERE, 204 BrowserThread::UI, FROM_HERE,
205 base::Bind(&TaskManagerDialogImpl::Show, false)); 205 base::Bind(&TaskManagerDialogImpl::Show, false));
206 } 206 }
207 207
208 // static 208 // static
209 void TaskManagerDialog::ShowBackgroundPages() { 209 void TaskManagerDialog::ShowBackgroundPages() {
210 BrowserThread::PostTask( 210 BrowserThread::PostTask(
211 BrowserThread::UI, FROM_HERE, 211 BrowserThread::UI, FROM_HERE,
212 base::Bind(&TaskManagerDialogImpl::Show, true)); 212 base::Bind(&TaskManagerDialogImpl::Show, true));
213 } 213 }
214 214
215 // static 215 // static
216 bool TaskManagerDialog::UseWebUITaskManager() { 216 bool TaskManagerDialog::UseWebUITaskManager() {
217 return CommandLine::ForCurrentProcess()->HasSwitch( 217 return CommandLine::ForCurrentProcess()->HasSwitch(
218 switches::kWebUITaskManager); 218 switches::kWebUITaskManager);
219 } 219 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698