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