| 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/bookmark_bar_view.h" | 5 #include "chrome/browser/ui/views/bookmark_bar_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 // throw off the test. So, don't animate while testing. | 186 // throw off the test. So, don't animate while testing. |
| 187 show_animation_->Reset(1); | 187 show_animation_->Reset(1); |
| 188 } else { | 188 } else { |
| 189 show_animation_->Show(); | 189 show_animation_->Show(); |
| 190 } | 190 } |
| 191 } | 191 } |
| 192 | 192 |
| 193 virtual bool IsTriggerableEvent(const views::MouseEvent& e) { | 193 virtual bool IsTriggerableEvent(const views::MouseEvent& e) { |
| 194 // Left clicks should show the menu contents and right clicks should show | 194 // Left clicks should show the menu contents and right clicks should show |
| 195 // the context menu. They should not trigger the opening of underlying urls. | 195 // the context menu. They should not trigger the opening of underlying urls. |
| 196 if (e.GetFlags() == views::MouseEvent::EF_LEFT_BUTTON_DOWN || | 196 if (e.flags() == views::MouseEvent::EF_LEFT_BUTTON_DOWN || |
| 197 e.GetFlags() == views::MouseEvent::EF_RIGHT_BUTTON_DOWN) | 197 e.flags() == views::MouseEvent::EF_RIGHT_BUTTON_DOWN) |
| 198 return false; | 198 return false; |
| 199 | 199 |
| 200 WindowOpenDisposition disposition( | 200 WindowOpenDisposition disposition( |
| 201 event_utils::DispositionFromEventFlags(e.GetFlags())); | 201 event_utils::DispositionFromEventFlags(e.flags())); |
| 202 return disposition != CURRENT_TAB; | 202 return disposition != CURRENT_TAB; |
| 203 } | 203 } |
| 204 | 204 |
| 205 virtual void Paint(gfx::Canvas* canvas) { | 205 virtual void Paint(gfx::Canvas* canvas) { |
| 206 views::MenuButton::Paint(canvas, false); | 206 views::MenuButton::Paint(canvas, false); |
| 207 } | 207 } |
| 208 | 208 |
| 209 private: | 209 private: |
| 210 scoped_ptr<ui::SlideAnimation> show_animation_; | 210 scoped_ptr<ui::SlideAnimation> show_animation_; |
| 211 | 211 |
| (...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1395 // Mouse is over 'other' folder. | 1395 // Mouse is over 'other' folder. |
| 1396 *is_over_other = true; | 1396 *is_over_other = true; |
| 1397 *drop_on = true; | 1397 *drop_on = true; |
| 1398 found = true; | 1398 found = true; |
| 1399 } else if (!GetBookmarkButtonCount()) { | 1399 } else if (!GetBookmarkButtonCount()) { |
| 1400 // No bookmarks, accept the drop. | 1400 // No bookmarks, accept the drop. |
| 1401 *index = 0; | 1401 *index = 0; |
| 1402 int ops = data.GetFirstNode(profile_) | 1402 int ops = data.GetFirstNode(profile_) |
| 1403 ? ui::DragDropTypes::DRAG_MOVE | 1403 ? ui::DragDropTypes::DRAG_MOVE |
| 1404 : ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK; | 1404 : ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK; |
| 1405 return | 1405 return bookmark_utils::PreferredDropOperation(event.source_operations(), |
| 1406 bookmark_utils::PreferredDropOperation(event.GetSourceOperations(), | 1406 ops); |
| 1407 ops); | |
| 1408 } | 1407 } |
| 1409 | 1408 |
| 1410 for (int i = 0; i < GetBookmarkButtonCount() && | 1409 for (int i = 0; i < GetBookmarkButtonCount() && |
| 1411 GetBookmarkButton(i)->IsVisible() && !found; i++) { | 1410 GetBookmarkButton(i)->IsVisible() && !found; i++) { |
| 1412 views::TextButton* button = GetBookmarkButton(i); | 1411 views::TextButton* button = GetBookmarkButton(i); |
| 1413 int button_x = mirrored_x - button->x(); | 1412 int button_x = mirrored_x - button->x(); |
| 1414 int button_w = button->width(); | 1413 int button_w = button->width(); |
| 1415 if (button_x < button_w) { | 1414 if (button_x < button_w) { |
| 1416 found = true; | 1415 found = true; |
| 1417 const BookmarkNode* node = model_->GetBookmarkBarNode()->GetChild(i); | 1416 const BookmarkNode* node = model_->GetBookmarkBarNode()->GetChild(i); |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1744 // The tooltip is the only way we have to display text explaining the error | 1743 // The tooltip is the only way we have to display text explaining the error |
| 1745 // to the user. | 1744 // to the user. |
| 1746 sync_error_button->SetTooltipText( | 1745 sync_error_button->SetTooltipText( |
| 1747 UTF16ToWide(l10n_util::GetStringUTF16(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC))); | 1746 UTF16ToWide(l10n_util::GetStringUTF16(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC))); |
| 1748 sync_error_button->SetAccessibleName( | 1747 sync_error_button->SetAccessibleName( |
| 1749 l10n_util::GetStringUTF16(IDS_ACCNAME_SYNC_ERROR_BUTTON)); | 1748 l10n_util::GetStringUTF16(IDS_ACCNAME_SYNC_ERROR_BUTTON)); |
| 1750 sync_error_button->SetIcon( | 1749 sync_error_button->SetIcon( |
| 1751 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING)); | 1750 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING)); |
| 1752 return sync_error_button; | 1751 return sync_error_button; |
| 1753 } | 1752 } |
| OLD | NEW |