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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 void WrenchMenu::RunMenu(views::MenuButton* host) { | 595 void WrenchMenu::RunMenu(views::MenuButton* host) { |
596 // Up the ref count while the menu is displaying. This way if the window is | 596 // Up the ref count while the menu is displaying. This way if the window is |
597 // deleted while we're running we won't prematurely delete the menu. | 597 // deleted while we're running we won't prematurely delete the menu. |
598 // TODO(sky): fix this, the menu should really take ownership of the menu | 598 // TODO(sky): fix this, the menu should really take ownership of the menu |
599 // (57890). | 599 // (57890). |
600 scoped_refptr<WrenchMenu> dont_delete_while_running(this); | 600 scoped_refptr<WrenchMenu> dont_delete_while_running(this); |
601 gfx::Point screen_loc; | 601 gfx::Point screen_loc; |
602 views::View::ConvertPointToScreen(host, &screen_loc); | 602 views::View::ConvertPointToScreen(host, &screen_loc); |
603 gfx::Rect bounds(screen_loc, host->size()); | 603 gfx::Rect bounds(screen_loc, host->size()); |
604 UserMetrics::RecordAction(UserMetricsAction("ShowAppMenu")); | 604 UserMetrics::RecordAction(UserMetricsAction("ShowAppMenu")); |
605 root_->RunMenuAt(host->GetWindow()->GetNativeWindow(), host, bounds, | 605 root_->RunMenuAt(host->GetWidget()->GetNativeWindow(), host, bounds, |
606 MenuItemView::TOPRIGHT, true); | 606 MenuItemView::TOPRIGHT, true); |
607 if (bookmark_menu_delegate_.get()) { | 607 if (bookmark_menu_delegate_.get()) { |
608 BookmarkModel* model = browser_->profile()->GetBookmarkModel(); | 608 BookmarkModel* model = browser_->profile()->GetBookmarkModel(); |
609 if (model) | 609 if (model) |
610 model->RemoveObserver(this); | 610 model->RemoveObserver(this); |
611 } | 611 } |
612 if (selected_menu_model_) | 612 if (selected_menu_model_) |
613 selected_menu_model_->ActivatedAt(selected_index_); | 613 selected_menu_model_->ActivatedAt(selected_index_); |
614 } | 614 } |
615 | 615 |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 model->AddObserver(this); | 865 model->AddObserver(this); |
866 bookmark_menu_delegate_.reset( | 866 bookmark_menu_delegate_.reset( |
867 new BookmarkMenuDelegate(browser_->profile(), | 867 new BookmarkMenuDelegate(browser_->profile(), |
868 NULL, | 868 NULL, |
869 browser_->window()->GetNativeHandle(), | 869 browser_->window()->GetNativeHandle(), |
870 first_bookmark_command_id_)); | 870 first_bookmark_command_id_)); |
871 bookmark_menu_delegate_->Init( | 871 bookmark_menu_delegate_->Init( |
872 this, bookmark_menu_, model->GetBookmarkBarNode(), 0, | 872 this, bookmark_menu_, model->GetBookmarkBarNode(), 0, |
873 BookmarkMenuDelegate::SHOW_OTHER_FOLDER); | 873 BookmarkMenuDelegate::SHOW_OTHER_FOLDER); |
874 } | 874 } |
OLD | NEW |