| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/views/extensions/extension_shelf.h" | 5 #include "chrome/browser/views/extensions/extension_shelf.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 // We need an extra margin to the left of all the toolstrips in detached mode, | 56 // We need an extra margin to the left of all the toolstrips in detached mode, |
| 57 // so that the first toolstrip doesn't look so squished against the rounded | 57 // so that the first toolstrip doesn't look so squished against the rounded |
| 58 // corners of the extension shelf. | 58 // corners of the extension shelf. |
| 59 static const int kNewtabExtraHorMargin = 2; | 59 static const int kNewtabExtraHorMargin = 2; |
| 60 static const int kNewtabExtraVerMargin = 2; | 60 static const int kNewtabExtraVerMargin = 2; |
| 61 | 61 |
| 62 // Height of the toolstrip within the shelf. | 62 // Height of the toolstrip within the shelf. |
| 63 static const int kToolstripHeight = kShelfHeight - (kTopMargin + kBottomMargin); | 63 static const int kToolstripHeight = kShelfHeight - (kTopMargin + kBottomMargin); |
| 64 | 64 |
| 65 // Colors for the ExtensionShelf. | |
| 66 static const SkColor kDividerHighlightColor = SkColorSetRGB(247, 250, 253); | |
| 67 | |
| 68 // Handle padding. | 65 // Handle padding. |
| 69 static const int kHandlePadding = 4; | 66 static const int kHandlePadding = 4; |
| 70 | 67 |
| 71 // Delays for showing and hiding the shelf handle. | 68 // Delays for showing and hiding the shelf handle. |
| 72 static const int kShowDelayMs = 500; | 69 static const int kShowDelayMs = 500; |
| 73 static const int kHideDelayMs = 300; | 70 static const int kHideDelayMs = 300; |
| 74 | 71 |
| 75 } // namespace | 72 } // namespace |
| 76 | 73 |
| 77 | 74 |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 InitBackground(canvas, background_rect); | 649 InitBackground(canvas, background_rect); |
| 653 | 650 |
| 654 // Draw vertical dividers between Toolstrip items in the Extension shelf. | 651 // Draw vertical dividers between Toolstrip items in the Extension shelf. |
| 655 int count = GetChildViewCount(); | 652 int count = GetChildViewCount(); |
| 656 for (int i = 0; i < count; ++i) { | 653 for (int i = 0; i < count; ++i) { |
| 657 int right = GetChildViewAt(i)->bounds().right() + kToolstripPadding; | 654 int right = GetChildViewAt(i)->bounds().right() + kToolstripPadding; |
| 658 int vertical_padding = IsDetached() ? (height() - kShelfHeight) / 2 : 1; | 655 int vertical_padding = IsDetached() ? (height() - kShelfHeight) / 2 : 1; |
| 659 | 656 |
| 660 DetachableToolbarView::PaintVerticalDivider( | 657 DetachableToolbarView::PaintVerticalDivider( |
| 661 canvas, right, height(), vertical_padding, | 658 canvas, right, height(), vertical_padding, |
| 662 SK_ColorWHITE, | 659 DetachableToolbarView::kEdgeDividerColor, |
| 663 kDividerHighlightColor, | 660 DetachableToolbarView::kMiddleDividerColor, |
| 664 GetThemeProvider()->GetColor(BrowserThemeProvider::COLOR_TOOLBAR)); | 661 GetThemeProvider()->GetColor(BrowserThemeProvider::COLOR_TOOLBAR)); |
| 665 } | 662 } |
| 666 } | 663 } |
| 667 | 664 |
| 668 // static | 665 // static |
| 669 void ExtensionShelf::ToggleWhenExtensionShelfVisible(Profile* profile) { | 666 void ExtensionShelf::ToggleWhenExtensionShelfVisible(Profile* profile) { |
| 670 PrefService* prefs = profile->GetPrefs(); | 667 PrefService* prefs = profile->GetPrefs(); |
| 671 const bool always_show = !prefs->GetBoolean(prefs::kShowExtensionShelf); | 668 const bool always_show = !prefs->GetBoolean(prefs::kShowExtensionShelf); |
| 672 | 669 |
| 673 // The user changed when the Extension Shelf is shown, update the | 670 // The user changed when the Extension Shelf is shown, update the |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 | 1029 |
| 1033 bool ExtensionShelf::IsAlwaysShown() const { | 1030 bool ExtensionShelf::IsAlwaysShown() const { |
| 1034 Profile* profile = browser_->profile(); | 1031 Profile* profile = browser_->profile(); |
| 1035 return profile->GetPrefs()->GetBoolean(prefs::kShowExtensionShelf); | 1032 return profile->GetPrefs()->GetBoolean(prefs::kShowExtensionShelf); |
| 1036 } | 1033 } |
| 1037 | 1034 |
| 1038 bool ExtensionShelf::OnNewTabPage() const { | 1035 bool ExtensionShelf::OnNewTabPage() const { |
| 1039 return (browser_ && browser_->GetSelectedTabContents() && | 1036 return (browser_ && browser_->GetSelectedTabContents() && |
| 1040 browser_->GetSelectedTabContents()->IsExtensionShelfAlwaysVisible()); | 1037 browser_->GetSelectedTabContents()->IsExtensionShelfAlwaysVisible()); |
| 1041 } | 1038 } |
| OLD | NEW |