Mac: Hook up the page menu's "Encoding" submenu.
Hook the NSMenu's delegate up to the ToolbarController in the nib and
generalize EncodingMenuControllerDelegate to work with a NSMenu
object instead of grabbing the app menu.
BUG=22639
TEST=ToolbarControllerTest.PopulateEncodingMenu
Review URL: http://codereview.chromium.org/225016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27008 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index d8885d08..f2d1b2a 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -338,7 +338,11 @@
// current locale (see http://crbug.com/7647 for details).
// We need a valid g_browser_process to get the profile which is why we can't
// call this from awakeFromNib.
- EncodingMenuControllerDelegate::BuildEncodingMenu([self defaultProfile]);
+ NSMenu* view_menu = [[[NSApp mainMenu] itemWithTag:IDC_VIEW_MENU] submenu];
+ NSMenuItem* encoding_menu_item = [view_menu itemWithTag:IDC_ENCODING_MENU];
+ NSMenu *encoding_menu = [encoding_menu_item submenu];
+ EncodingMenuControllerDelegate::BuildEncodingMenu([self defaultProfile],
+ encoding_menu);
// Now that we're initialized we can open any URLs we've been holding onto.
[self openPendingURLs];