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

Side by Side Diff: chrome/browser/ui/views/task_manager_view.cc

Issue 11975038: Implement rough new Views task manager style. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use 'Chrome Style' TextButtons instead. Created 7 years, 11 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 | ui/views/widget/widget.h » ('j') | 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/task_manager/task_manager.h" 5 #include "chrome/browser/task_manager/task_manager.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/metrics/stats_table.h" 9 #include "base/metrics/stats_table.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 10 matching lines...) Expand all
21 #include "chrome/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
22 #include "grit/chromium_strings.h" 22 #include "grit/chromium_strings.h"
23 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
24 #include "grit/theme_resources.h" 24 #include "grit/theme_resources.h"
25 #include "ui/base/accelerators/accelerator.h" 25 #include "ui/base/accelerators/accelerator.h"
26 #include "ui/base/l10n/l10n_util.h" 26 #include "ui/base/l10n/l10n_util.h"
27 #include "ui/base/models/simple_menu_model.h" 27 #include "ui/base/models/simple_menu_model.h"
28 #include "ui/base/models/table_model_observer.h" 28 #include "ui/base/models/table_model_observer.h"
29 #include "ui/views/background.h" 29 #include "ui/views/background.h"
30 #include "ui/views/context_menu_controller.h" 30 #include "ui/views/context_menu_controller.h"
31 #include "ui/views/controls/button/chrome_style.h"
31 #include "ui/views/controls/button/text_button.h" 32 #include "ui/views/controls/button/text_button.h"
32 #include "ui/views/controls/link.h" 33 #include "ui/views/controls/link.h"
33 #include "ui/views/controls/link_listener.h" 34 #include "ui/views/controls/link_listener.h"
34 #include "ui/views/controls/menu/menu_model_adapter.h" 35 #include "ui/views/controls/menu/menu_model_adapter.h"
35 #include "ui/views/controls/menu/menu_runner.h" 36 #include "ui/views/controls/menu/menu_runner.h"
36 #include "ui/views/controls/table/group_table_model.h" 37 #include "ui/views/controls/table/group_table_model.h"
37 #include "ui/views/controls/table/group_table_view.h" 38 #include "ui/views/controls/table/group_table_view.h"
38 #include "ui/views/controls/table/table_view_observer.h" 39 #include "ui/views/controls/table/table_view_observer.h"
39 #include "ui/views/layout/layout_constants.h" 40 #include "ui/views/layout/layout_constants.h"
40 #include "ui/views/widget/widget.h" 41 #include "ui/views/widget/widget.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 412
412 UpdateStatsCounters(); 413 UpdateStatsCounters();
413 tab_table_->SetObserver(this); 414 tab_table_->SetObserver(this);
414 tab_table_->set_context_menu_controller(this); 415 tab_table_->set_context_menu_controller(this);
415 set_context_menu_controller(this); 416 set_context_menu_controller(this);
416 // If we're running with --purge-memory-button, add a "Purge memory" button. 417 // If we're running with --purge-memory-button, add a "Purge memory" button.
417 if (CommandLine::ForCurrentProcess()->HasSwitch( 418 if (CommandLine::ForCurrentProcess()->HasSwitch(
418 switches::kPurgeMemoryButton)) { 419 switches::kPurgeMemoryButton)) {
419 purge_memory_button_ = new views::NativeTextButton(this, 420 purge_memory_button_ = new views::NativeTextButton(this,
420 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_PURGE_MEMORY)); 421 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_PURGE_MEMORY));
422 if (DialogDelegate::UseNewStyle())
423 views::ApplyChromeStyle(purge_memory_button_);
421 } 424 }
422 kill_button_ = new views::NativeTextButton(this, 425 kill_button_ = new views::NativeTextButton(this,
423 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_KILL)); 426 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_KILL));
427 if (DialogDelegate::UseNewStyle())
428 views::ApplyChromeStyle(kill_button_);
424 about_memory_link_ = new views::Link( 429 about_memory_link_ = new views::Link(
425 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_ABOUT_MEMORY_LINK)); 430 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_ABOUT_MEMORY_LINK));
426 about_memory_link_->set_listener(this); 431 about_memory_link_->set_listener(this);
427 432
428 // Makes sure our state is consistent. 433 // Makes sure our state is consistent.
429 OnSelectionChanged(); 434 OnSelectionChanged();
430 } 435 }
431 436
432 void TaskManagerView::UpdateStatsCounters() { 437 void TaskManagerView::UpdateStatsCounters() {
433 base::StatsTable* stats = base::StatsTable::current(); 438 base::StatsTable* stats = base::StatsTable::current();
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 highlight_background_resources || 544 highlight_background_resources ||
540 instance_->desktop_type_ != desktop_type) { 545 instance_->desktop_type_ != desktop_type) {
541 instance_->GetWidget()->Close(); 546 instance_->GetWidget()->Close();
542 } else { 547 } else {
543 // If there's a Task manager window open already, just activate it. 548 // If there's a Task manager window open already, just activate it.
544 instance_->GetWidget()->Activate(); 549 instance_->GetWidget()->Activate();
545 return; 550 return;
546 } 551 }
547 } 552 }
548 instance_ = new TaskManagerView(highlight_background_resources, desktop_type); 553 instance_ = new TaskManagerView(highlight_background_resources, desktop_type);
549 views::Widget::CreateWindow(instance_); 554
555 views::Widget* widget = new views::Widget;
556 views::Widget::InitParams params;
557 params.delegate = instance_;
558 if (DialogDelegate::UseNewStyle()) {
559 // TODO(msw): Use table_view_views or support dialog transparency and native
560 // controls (e.g. table_view_win) via a second dialog Widget (like bubbles).
561 // params.transparent = true;
562 params.remove_standard_frame = true;
563 }
564 params.top_level = true;
565 widget->Init(params);
566
550 instance_->InitAlwaysOnTopState(); 567 instance_->InitAlwaysOnTopState();
551 instance_->model_->StartUpdating(); 568 instance_->model_->StartUpdating();
552 instance_->GetWidget()->Show(); 569 instance_->GetWidget()->Show();
553 570
554 // Set the initial focus to the list of tasks. 571 // Set the initial focus to the list of tasks.
555 views::FocusManager* focus_manager = instance_->GetFocusManager(); 572 views::FocusManager* focus_manager = instance_->GetFocusManager();
556 if (focus_manager) 573 if (focus_manager)
557 focus_manager->SetFocusedView(instance_->tab_table_); 574 focus_manager->SetFocusedView(instance_->tab_table_);
558 } 575 }
559 576
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 // Declared in browser_dialogs.h so others don't need to depend on our header. 782 // Declared in browser_dialogs.h so others don't need to depend on our header.
766 void ShowTaskManager(chrome::HostDesktopType desktop_type) { 783 void ShowTaskManager(chrome::HostDesktopType desktop_type) {
767 TaskManagerView::Show(false, desktop_type); 784 TaskManagerView::Show(false, desktop_type);
768 } 785 }
769 786
770 void ShowBackgroundPages(chrome::HostDesktopType desktop_type) { 787 void ShowBackgroundPages(chrome::HostDesktopType desktop_type) {
771 TaskManagerView::Show(true, desktop_type); 788 TaskManagerView::Show(true, desktop_type);
772 } 789 }
773 790
774 } // namespace chrome 791 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | ui/views/widget/widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698