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/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/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
490 parent->RemoveChildView(purge_memory_button_); | 490 parent->RemoveChildView(purge_memory_button_); |
491 parent->RemoveChildView(about_memory_link_); | 491 parent->RemoveChildView(about_memory_link_); |
492 } | 492 } |
493 } | 493 } |
494 } | 494 } |
495 | 495 |
496 void TaskManagerView::Layout() { | 496 void TaskManagerView::Layout() { |
497 bool new_style = views::DialogDelegate::UseNewStyle(); | 497 bool new_style = views::DialogDelegate::UseNewStyle(); |
498 gfx::Size size = kill_button_->GetPreferredSize(); | 498 gfx::Size size = kill_button_->GetPreferredSize(); |
499 gfx::Rect parent_bounds = parent()->GetContentsBounds(); | 499 gfx::Rect parent_bounds = parent()->GetContentsBounds(); |
500 int x = width() - size.width() - (new_style ? 0 : views::kPanelHorizMargin); | 500 int x = width() - size.width() - |
501 (new_style ? views::kPanelHorizMarginNewStyle : views::kPanelHorizMargin); | |
msw
2013/04/15 22:48:37
nit: make a local for this margin value to use her
Evan Stade
2013/04/16 00:20:37
Done.
| |
501 int y_buttons = new_style ? GetLocalBounds().bottom() - size.height() : | 502 int y_buttons = new_style ? GetLocalBounds().bottom() - size.height() : |
502 parent_bounds.bottom() - size.height() - views::kButtonVEdgeMargin; | 503 parent_bounds.bottom() - size.height() - views::kButtonVEdgeMargin; |
503 kill_button_->SetBounds(x, y_buttons, size.width(), size.height()); | 504 kill_button_->SetBounds(x, y_buttons, size.width(), size.height()); |
504 | 505 |
505 if (purge_memory_button_) { | 506 if (purge_memory_button_) { |
506 size = purge_memory_button_->GetPreferredSize(); | 507 size = purge_memory_button_->GetPreferredSize(); |
507 purge_memory_button_->SetBounds( | 508 purge_memory_button_->SetBounds( |
508 kill_button_->x() - size.width() - | 509 kill_button_->x() - size.width() - |
509 views::kUnrelatedControlHorizontalSpacing, | 510 views::kUnrelatedControlHorizontalSpacing, |
510 y_buttons, size.width(), size.height()); | 511 y_buttons, size.width(), size.height()); |
511 } | 512 } |
512 | 513 |
514 // TODO(estade): This should use DialogDelegate::CreateExtraView. | |
513 size = about_memory_link_->GetPreferredSize(); | 515 size = about_memory_link_->GetPreferredSize(); |
514 about_memory_link_->SetBounds(new_style ? 0 : views::kPanelHorizMargin, | 516 about_memory_link_->SetBounds( |
517 new_style ? views::kPanelHorizMarginNewStyle : views::kPanelHorizMargin, | |
515 y_buttons + (kill_button_->height() - size.height()) / 2, | 518 y_buttons + (kill_button_->height() - size.height()) / 2, |
516 size.width(), size.height()); | 519 size.width(), size.height()); |
517 | 520 |
518 gfx::Rect rect = GetLocalBounds(); | 521 gfx::Rect rect = GetLocalBounds(); |
519 if (!new_style) | 522 rect.Inset(new_style ? views::kPanelHorizMarginNewStyle : |
520 rect.Inset(views::kPanelHorizMargin, views::kPanelVertMargin); | 523 views::kPanelHorizMargin, |
524 views::kPanelVertMargin); | |
521 rect.Inset(0, 0, 0, | 525 rect.Inset(0, 0, 0, |
522 kill_button_->height() + views::kUnrelatedControlVerticalSpacing); | 526 kill_button_->height() + views::kUnrelatedControlVerticalSpacing); |
523 tab_table_parent_->SetBoundsRect(rect); | 527 tab_table_parent_->SetBoundsRect(rect); |
524 } | 528 } |
525 | 529 |
526 gfx::Size TaskManagerView::GetPreferredSize() { | 530 gfx::Size TaskManagerView::GetPreferredSize() { |
527 return gfx::Size(460, 270); | 531 return gfx::Size(460, 270); |
528 } | 532 } |
529 | 533 |
530 // static | 534 // static |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
771 } // namespace | 775 } // namespace |
772 | 776 |
773 namespace chrome { | 777 namespace chrome { |
774 | 778 |
775 // Declared in browser_dialogs.h so others don't need to depend on our header. | 779 // Declared in browser_dialogs.h so others don't need to depend on our header. |
776 void ShowTaskManager(Browser* browser, bool highlight_background_resources) { | 780 void ShowTaskManager(Browser* browser, bool highlight_background_resources) { |
777 TaskManagerView::Show(highlight_background_resources, browser); | 781 TaskManagerView::Show(highlight_background_resources, browser); |
778 } | 782 } |
779 | 783 |
780 } // namespace chrome | 784 } // namespace chrome |
OLD | NEW |