Chromium Code Reviews| 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 horizontal_margin = |
| 501 int y_buttons = new_style ? GetLocalBounds().bottom() - size.height() : | 501 new_style ? views::kButtonHEdgeMarginNew : views::kPanelHorizMargin; |
| 502 parent_bounds.bottom() - size.height() - views::kButtonVEdgeMargin; | 502 int vertical_margin = |
| 503 new_style ? views::kButtonVEdgeMarginNew : views::kButtonVEdgeMargin; | |
| 504 int x = width() - size.width() - horizontal_margin; | |
| 505 int y_buttons = | |
| 506 parent_bounds.bottom() - size.height() - vertical_margin; | |
|
msw
2013/04/16 00:53:21
nit: fits on the line above.
| |
| 503 kill_button_->SetBounds(x, y_buttons, size.width(), size.height()); | 507 kill_button_->SetBounds(x, y_buttons, size.width(), size.height()); |
| 504 | 508 |
| 505 if (purge_memory_button_) { | 509 if (purge_memory_button_) { |
| 506 size = purge_memory_button_->GetPreferredSize(); | 510 size = purge_memory_button_->GetPreferredSize(); |
| 507 purge_memory_button_->SetBounds( | 511 purge_memory_button_->SetBounds( |
| 508 kill_button_->x() - size.width() - | 512 kill_button_->x() - size.width() - |
| 509 views::kUnrelatedControlHorizontalSpacing, | 513 views::kUnrelatedControlHorizontalSpacing, |
| 510 y_buttons, size.width(), size.height()); | 514 y_buttons, size.width(), size.height()); |
| 511 } | 515 } |
| 512 | 516 |
| 513 size = about_memory_link_->GetPreferredSize(); | 517 size = about_memory_link_->GetPreferredSize(); |
| 514 about_memory_link_->SetBounds(new_style ? 0 : views::kPanelHorizMargin, | 518 about_memory_link_->SetBounds( |
| 519 horizontal_margin, | |
| 515 y_buttons + (kill_button_->height() - size.height()) / 2, | 520 y_buttons + (kill_button_->height() - size.height()) / 2, |
| 516 size.width(), size.height()); | 521 size.width(), size.height()); |
| 517 | 522 |
| 518 gfx::Rect rect = GetLocalBounds(); | 523 gfx::Rect rect = GetLocalBounds(); |
| 519 if (!new_style) | 524 rect.Inset(horizontal_margin, |
| 520 rect.Inset(views::kPanelHorizMargin, views::kPanelVertMargin); | 525 views::kPanelVertMargin); |
|
msw
2013/04/16 00:53:21
nit: fits on the line above.
Evan Stade
2013/04/16 01:39:39
Done.
| |
| 521 rect.Inset(0, 0, 0, | 526 rect.Inset(0, 0, 0, |
| 522 kill_button_->height() + views::kUnrelatedControlVerticalSpacing); | 527 kill_button_->height() + views::kUnrelatedControlVerticalSpacing); |
| 523 tab_table_parent_->SetBoundsRect(rect); | 528 tab_table_parent_->SetBoundsRect(rect); |
| 524 } | 529 } |
| 525 | 530 |
| 526 gfx::Size TaskManagerView::GetPreferredSize() { | 531 gfx::Size TaskManagerView::GetPreferredSize() { |
| 527 return gfx::Size(460, 270); | 532 return gfx::Size(460, 270); |
| 528 } | 533 } |
| 529 | 534 |
| 530 // static | 535 // static |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 771 } // namespace | 776 } // namespace |
| 772 | 777 |
| 773 namespace chrome { | 778 namespace chrome { |
| 774 | 779 |
| 775 // Declared in browser_dialogs.h so others don't need to depend on our header. | 780 // Declared in browser_dialogs.h so others don't need to depend on our header. |
| 776 void ShowTaskManager(Browser* browser, bool highlight_background_resources) { | 781 void ShowTaskManager(Browser* browser, bool highlight_background_resources) { |
| 777 TaskManagerView::Show(highlight_background_resources, browser); | 782 TaskManagerView::Show(highlight_background_resources, browser); |
| 778 } | 783 } |
| 779 | 784 |
| 780 } // namespace chrome | 785 } // namespace chrome |
| OLD | NEW |