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/wrench_menu.h" | 5 #include "chrome/browser/ui/views/wrench_menu.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 // Up the ref count while the menu is displaying. This way if the window is | 597 // Up the ref count while the menu is displaying. This way if the window is |
598 // deleted while we're running we won't prematurely delete the menu. | 598 // deleted while we're running we won't prematurely delete the menu. |
599 // TODO(sky): fix this, the menu should really take ownership of the menu | 599 // TODO(sky): fix this, the menu should really take ownership of the menu |
600 // (57890). | 600 // (57890). |
601 scoped_refptr<WrenchMenu> dont_delete_while_running(this); | 601 scoped_refptr<WrenchMenu> dont_delete_while_running(this); |
602 gfx::Point screen_loc; | 602 gfx::Point screen_loc; |
603 views::View::ConvertPointToScreen(host, &screen_loc); | 603 views::View::ConvertPointToScreen(host, &screen_loc); |
604 gfx::Rect bounds(screen_loc, host->size()); | 604 gfx::Rect bounds(screen_loc, host->size()); |
605 UserMetrics::RecordAction(UserMetricsAction("ShowAppMenu")); | 605 UserMetrics::RecordAction(UserMetricsAction("ShowAppMenu")); |
606 root_->RunMenuAt(host->GetWindow()->GetNativeWindow(), host, bounds, | 606 root_->RunMenuAt(host->GetWindow()->GetNativeWindow(), host, bounds, |
607 base::i18n::IsRTL() ? MenuItemView::TOPLEFT : MenuItemView::TOPRIGHT, | 607 MenuItemView::TOPRIGHT, true); |
608 true); | |
609 if (bookmark_menu_delegate_.get()) { | 608 if (bookmark_menu_delegate_.get()) { |
610 BookmarkModel* model = browser_->profile()->GetBookmarkModel(); | 609 BookmarkModel* model = browser_->profile()->GetBookmarkModel(); |
611 if (model) | 610 if (model) |
612 model->RemoveObserver(this); | 611 model->RemoveObserver(this); |
613 } | 612 } |
614 if (selected_menu_model_) | 613 if (selected_menu_model_) |
615 selected_menu_model_->ActivatedAt(selected_index_); | 614 selected_menu_model_->ActivatedAt(selected_index_); |
616 } | 615 } |
617 | 616 |
618 std::wstring WrenchMenu::GetTooltipText(int id, | 617 std::wstring WrenchMenu::GetTooltipText(int id, |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 model->AddObserver(this); | 866 model->AddObserver(this); |
868 bookmark_menu_delegate_.reset( | 867 bookmark_menu_delegate_.reset( |
869 new BookmarkMenuDelegate(browser_->profile(), | 868 new BookmarkMenuDelegate(browser_->profile(), |
870 NULL, | 869 NULL, |
871 browser_->window()->GetNativeHandle(), | 870 browser_->window()->GetNativeHandle(), |
872 first_bookmark_command_id_)); | 871 first_bookmark_command_id_)); |
873 bookmark_menu_delegate_->Init( | 872 bookmark_menu_delegate_->Init( |
874 this, bookmark_menu_, model->GetBookmarkBarNode(), 0, | 873 this, bookmark_menu_, model->GetBookmarkBarNode(), 0, |
875 BookmarkMenuDelegate::SHOW_OTHER_FOLDER); | 874 BookmarkMenuDelegate::SHOW_OTHER_FOLDER); |
876 } | 875 } |
OLD | NEW |