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 #import "chrome/browser/ui/cocoa/location_bar/plus_decoration.h" | 5 #import "chrome/browser/ui/cocoa/location_bar/plus_decoration.h" |
6 | 6 |
7 #include "chrome/browser/command_updater.h" | 7 #include "chrome/browser/command_updater.h" |
8 #include "chrome/browser/extensions/extension_system.h" | 8 #include "chrome/browser/extensions/extension_system.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 PlusDecoration::~PlusDecoration() { | 40 PlusDecoration::~PlusDecoration() { |
41 } | 41 } |
42 | 42 |
43 bool PlusDecoration::AcceptsMousePress() { | 43 bool PlusDecoration::AcceptsMousePress() { |
44 return true; | 44 return true; |
45 } | 45 } |
46 | 46 |
47 bool PlusDecoration::OnMousePressed(NSRect frame) { | 47 bool PlusDecoration::OnMousePressed(NSRect frame) { |
48 ExtensionService* extension_service = extensions::ExtensionSystem::Get( | 48 ExtensionService* extension_service = extensions::ExtensionSystem::Get( |
49 browser_->profile())->extension_service(); | 49 browser_->profile())->extension_service(); |
50 ActionBoxMenuModel menu_model(browser_, extension_service); | 50 ActionBoxMenuModel menu_model(browser_, extension_service, command_updater_); |
51 | 51 |
52 // Controller for the menu attached to the plus decoration. | 52 // Controller for the menu attached to the plus decoration. |
53 scoped_nsobject<MenuController> menu_controller( | 53 scoped_nsobject<MenuController> menu_controller( |
54 [[MenuController alloc] initWithModel:&menu_model | 54 [[MenuController alloc] initWithModel:&menu_model |
55 useWithPopUpButtonCell:YES]); | 55 useWithPopUpButtonCell:YES]); |
56 | 56 |
57 NSMenu* menu = [menu_controller menu]; | 57 NSMenu* menu = [menu_controller menu]; |
58 | 58 |
59 // Align the menu popup to that its top-right corner matches the bottom-right | 59 // Align the menu popup to that its top-right corner matches the bottom-right |
60 // corner of the omnibox. | 60 // corner of the omnibox. |
(...skipping 14 matching lines...) Expand all Loading... |
75 | 75 |
76 NSString* PlusDecoration::GetToolTip() { | 76 NSString* PlusDecoration::GetToolTip() { |
77 return tooltip_.get(); | 77 return tooltip_.get(); |
78 } | 78 } |
79 | 79 |
80 NSPoint PlusDecoration::GetActionBoxAnchorPoint() { | 80 NSPoint PlusDecoration::GetActionBoxAnchorPoint() { |
81 AutocompleteTextField* field = owner_->GetAutocompleteTextField(); | 81 AutocompleteTextField* field = owner_->GetAutocompleteTextField(); |
82 NSRect bounds = [field bounds]; | 82 NSRect bounds = [field bounds]; |
83 return NSMakePoint(NSMaxX(bounds), NSMaxY(bounds)); | 83 return NSMakePoint(NSMaxX(bounds), NSMaxY(bounds)); |
84 } | 84 } |
OLD | NEW |