| 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/ui/views/bookmarks/bookmark_bar_view.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 #include "components/browser_sync/profile_sync_service.h" | 59 #include "components/browser_sync/profile_sync_service.h" |
| 60 #include "components/metrics/metrics_service.h" | 60 #include "components/metrics/metrics_service.h" |
| 61 #include "components/omnibox/browser/omnibox_popup_model.h" | 61 #include "components/omnibox/browser/omnibox_popup_model.h" |
| 62 #include "components/omnibox/browser/omnibox_view.h" | 62 #include "components/omnibox/browser/omnibox_view.h" |
| 63 #include "components/prefs/pref_service.h" | 63 #include "components/prefs/pref_service.h" |
| 64 #include "components/url_formatter/elide_url.h" | 64 #include "components/url_formatter/elide_url.h" |
| 65 #include "content/public/browser/user_metrics.h" | 65 #include "content/public/browser/user_metrics.h" |
| 66 #include "extensions/browser/extension_registry.h" | 66 #include "extensions/browser/extension_registry.h" |
| 67 #include "extensions/common/extension.h" | 67 #include "extensions/common/extension.h" |
| 68 #include "extensions/common/extension_set.h" | 68 #include "extensions/common/extension_set.h" |
| 69 #include "ui/accessibility/ax_view_state.h" | 69 #include "ui/accessibility/ax_node_data.h" |
| 70 #include "ui/base/dragdrop/drag_utils.h" | 70 #include "ui/base/dragdrop/drag_utils.h" |
| 71 #include "ui/base/dragdrop/os_exchange_data.h" | 71 #include "ui/base/dragdrop/os_exchange_data.h" |
| 72 #include "ui/base/l10n/l10n_util.h" | 72 #include "ui/base/l10n/l10n_util.h" |
| 73 #include "ui/base/page_transition_types.h" | 73 #include "ui/base/page_transition_types.h" |
| 74 #include "ui/base/resource/resource_bundle.h" | 74 #include "ui/base/resource/resource_bundle.h" |
| 75 #include "ui/base/theme_provider.h" | 75 #include "ui/base/theme_provider.h" |
| 76 #include "ui/base/window_open_disposition.h" | 76 #include "ui/base/window_open_disposition.h" |
| 77 #include "ui/compositor/paint_recorder.h" | 77 #include "ui/compositor/paint_recorder.h" |
| 78 #include "ui/gfx/animation/slide_animation.h" | 78 #include "ui/gfx/animation/slide_animation.h" |
| 79 #include "ui/gfx/canvas.h" | 79 #include "ui/gfx/canvas.h" |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 GetThemeProvider()->GetColor( | 507 GetThemeProvider()->GetColor( |
| 508 ThemeProperties::COLOR_TOOLBAR_VERTICAL_SEPARATOR)); | 508 ThemeProperties::COLOR_TOOLBAR_VERTICAL_SEPARATOR)); |
| 509 } | 509 } |
| 510 | 510 |
| 511 gfx::Size GetPreferredSize() const override { | 511 gfx::Size GetPreferredSize() const override { |
| 512 // We get the full height of the bookmark bar, so that the height returned | 512 // We get the full height of the bookmark bar, so that the height returned |
| 513 // here doesn't matter. | 513 // here doesn't matter. |
| 514 return gfx::Size(kSeparatorWidth, 1); | 514 return gfx::Size(kSeparatorWidth, 1); |
| 515 } | 515 } |
| 516 | 516 |
| 517 void GetAccessibleState(ui::AXViewState* state) override { | 517 void GetAccessibleNodeData(ui::AXNodeData* node_data) override { |
| 518 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_SEPARATOR); | 518 node_data->SetName(l10n_util::GetStringUTF8(IDS_ACCNAME_SEPARATOR)); |
| 519 state->role = ui::AX_ROLE_SPLITTER; | 519 node_data->role = ui::AX_ROLE_SPLITTER; |
| 520 } | 520 } |
| 521 | 521 |
| 522 private: | 522 private: |
| 523 DISALLOW_COPY_AND_ASSIGN(ButtonSeparatorView); | 523 DISALLOW_COPY_AND_ASSIGN(ButtonSeparatorView); |
| 524 }; | 524 }; |
| 525 | 525 |
| 526 // BookmarkBarView ------------------------------------------------------------ | 526 // BookmarkBarView ------------------------------------------------------------ |
| 527 | 527 |
| 528 // static | 528 // static |
| 529 const char BookmarkBarView::kViewClassName[] = "BookmarkBarView"; | 529 const char BookmarkBarView::kViewClassName[] = "BookmarkBarView"; |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1189 | 1189 |
| 1190 void BookmarkBarView::VisibilityChanged(View* starting_from, bool is_visible) { | 1190 void BookmarkBarView::VisibilityChanged(View* starting_from, bool is_visible) { |
| 1191 AccessiblePaneView::VisibilityChanged(starting_from, is_visible); | 1191 AccessiblePaneView::VisibilityChanged(starting_from, is_visible); |
| 1192 | 1192 |
| 1193 if (starting_from == this) { | 1193 if (starting_from == this) { |
| 1194 for (BookmarkBarViewObserver& observer : observers_) | 1194 for (BookmarkBarViewObserver& observer : observers_) |
| 1195 observer.OnBookmarkBarVisibilityChanged(); | 1195 observer.OnBookmarkBarVisibilityChanged(); |
| 1196 } | 1196 } |
| 1197 } | 1197 } |
| 1198 | 1198 |
| 1199 void BookmarkBarView::GetAccessibleState(ui::AXViewState* state) { | 1199 void BookmarkBarView::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
| 1200 state->role = ui::AX_ROLE_TOOLBAR; | 1200 node_data->role = ui::AX_ROLE_TOOLBAR; |
| 1201 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_BOOKMARKS); | 1201 node_data->SetName(l10n_util::GetStringUTF8(IDS_ACCNAME_BOOKMARKS)); |
| 1202 } | 1202 } |
| 1203 | 1203 |
| 1204 void BookmarkBarView::AnimationProgressed(const gfx::Animation* animation) { | 1204 void BookmarkBarView::AnimationProgressed(const gfx::Animation* animation) { |
| 1205 // |browser_view_| can be null during tests. | 1205 // |browser_view_| can be null during tests. |
| 1206 if (browser_view_) | 1206 if (browser_view_) |
| 1207 browser_view_->ToolbarSizeChanged(true); | 1207 browser_view_->ToolbarSizeChanged(true); |
| 1208 } | 1208 } |
| 1209 | 1209 |
| 1210 void BookmarkBarView::AnimationEnded(const gfx::Animation* animation) { | 1210 void BookmarkBarView::AnimationEnded(const gfx::Animation* animation) { |
| 1211 // |browser_view_| can be null during tests. | 1211 // |browser_view_| can be null during tests. |
| (...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2114 return; | 2114 return; |
| 2115 apps_page_shortcut_->SetVisible(visible); | 2115 apps_page_shortcut_->SetVisible(visible); |
| 2116 UpdateBookmarksSeparatorVisibility(); | 2116 UpdateBookmarksSeparatorVisibility(); |
| 2117 LayoutAndPaint(); | 2117 LayoutAndPaint(); |
| 2118 } | 2118 } |
| 2119 | 2119 |
| 2120 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { | 2120 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { |
| 2121 if (UpdateOtherAndManagedButtonsVisibility()) | 2121 if (UpdateOtherAndManagedButtonsVisibility()) |
| 2122 LayoutAndPaint(); | 2122 LayoutAndPaint(); |
| 2123 } | 2123 } |
| OLD | NEW |