| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/views/bookmarks/bookmark_bar_instructions_view.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/defaults.h" | 10 #include "chrome/browser/defaults.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 } // namespace | 22 } // namespace |
| 23 | 23 |
| 24 BookmarkBarInstructionsView::BookmarkBarInstructionsView(Delegate* delegate) | 24 BookmarkBarInstructionsView::BookmarkBarInstructionsView(Delegate* delegate) |
| 25 : delegate_(delegate), | 25 : delegate_(delegate), |
| 26 instructions_(NULL), | 26 instructions_(NULL), |
| 27 import_link_(NULL), | 27 import_link_(NULL), |
| 28 baseline_(-1), | 28 baseline_(-1), |
| 29 updated_colors_(false) { | 29 updated_colors_(false) { |
| 30 instructions_ = new views::Label( | 30 instructions_ = new views::Label( |
| 31 l10n_util::GetStringUTF16(IDS_BOOKMARKS_NO_ITEMS)); | 31 l10n_util::GetStringUTF16(IDS_BOOKMARKS_NO_ITEMS)); |
| 32 instructions_->set_auto_color_readability_enabled(false); |
| 32 AddChildView(instructions_); | 33 AddChildView(instructions_); |
| 33 | 34 |
| 34 if (browser_defaults::kShowImportOnBookmarkBar) { | 35 if (browser_defaults::kShowImportOnBookmarkBar) { |
| 35 import_link_ = new views::Link( | 36 import_link_ = new views::Link( |
| 36 l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_IMPORT_LINK)); | 37 l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_IMPORT_LINK)); |
| 37 // We don't want the link to alter tab navigation. | 38 // We don't want the link to alter tab navigation. |
| 38 import_link_->set_focusable(false); | 39 import_link_->set_focusable(false); |
| 39 import_link_->set_listener(this); | 40 import_link_->set_listener(this); |
| 41 import_link_->set_auto_color_readability_enabled(false); |
| 40 AddChildView(import_link_); | 42 AddChildView(import_link_); |
| 41 } | 43 } |
| 42 } | 44 } |
| 43 | 45 |
| 44 gfx::Size BookmarkBarInstructionsView::GetPreferredSize() { | 46 gfx::Size BookmarkBarInstructionsView::GetPreferredSize() { |
| 45 int ascent = 0, descent = 0, height = 0, width = 0; | 47 int ascent = 0, descent = 0, height = 0, width = 0; |
| 46 for (int i = 0; i < child_count(); ++i) { | 48 for (int i = 0; i < child_count(); ++i) { |
| 47 views::View* view = child_at(i); | 49 views::View* view = child_at(i); |
| 48 gfx::Size pref = view->GetPreferredSize(); | 50 gfx::Size pref = view->GetPreferredSize(); |
| 49 int baseline = view->GetBaseline(); | 51 int baseline = view->GetBaseline(); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } | 104 } |
| 103 | 105 |
| 104 void BookmarkBarInstructionsView::UpdateColors() { | 106 void BookmarkBarInstructionsView::UpdateColors() { |
| 105 // We don't always have a theme provider (ui tests, for example). | 107 // We don't always have a theme provider (ui tests, for example). |
| 106 const ui::ThemeProvider* theme_provider = GetThemeProvider(); | 108 const ui::ThemeProvider* theme_provider = GetThemeProvider(); |
| 107 if (!theme_provider) | 109 if (!theme_provider) |
| 108 return; | 110 return; |
| 109 updated_colors_ = true; | 111 updated_colors_ = true; |
| 110 SkColor text_color = | 112 SkColor text_color = |
| 111 theme_provider->GetColor(ThemeService::COLOR_BOOKMARK_TEXT); | 113 theme_provider->GetColor(ThemeService::COLOR_BOOKMARK_TEXT); |
| 112 instructions_->SetColor(text_color); | 114 instructions_->SetEnabledColor(text_color); |
| 113 if (import_link_) | 115 if (import_link_) |
| 114 import_link_->SetColor(text_color); | 116 import_link_->SetEnabledColor(text_color); |
| 115 } | 117 } |
| OLD | NEW |