summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/browser_window_controller.mm
diff options
context:
space:
mode:
authorjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-14 17:10:41 +0000
committerjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-14 17:10:41 +0000
commitf14159cb6385f271bec21d4ddf04c353a869fb70 (patch)
tree2fc1ab6633333d1a7292f5e9acd21a8bd7d833b6 /chrome/browser/cocoa/browser_window_controller.mm
parentd680c5c189ec40b97cee8c201de88dfe5256153f (diff)
downloadchromium_src-f14159cb6385f271bec21d4ddf04c353a869fb70.zip
chromium_src-f14159cb6385f271bec21d4ddf04c353a869fb70.tar.gz
chromium_src-f14159cb6385f271bec21d4ddf04c353a869fb70.tar.bz2
Implement OS X Encoding Menu.
Also refactor Windows Encoding menu a bit to make the moving parts x-platform. Add a unit test for the menu encoding logic. In a followup CL I'll add some UI tests around this. Review URL: http://codereview.chromium.org/113315 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16061 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/browser_window_controller.mm')
-rw-r--r--chrome/browser/cocoa/browser_window_controller.mm22
1 files changed, 22 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm
index 283eb1e..92f3527 100644
--- a/chrome/browser/cocoa/browser_window_controller.mm
+++ b/chrome/browser/cocoa/browser_window_controller.mm
@@ -8,6 +8,7 @@
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/encoding_menu_controller.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_view.h"
#include "chrome/browser/tabs/tab_strip_model.h"
@@ -263,6 +264,27 @@ willPositionSheet:(NSWindow *)sheet
if (oldState != newState)
[item setState:newState];
}
+
+ // Update the checked/Unchecked state of items in the encoding menu.
+ // On Windows this logic is part of encoding_menu_controller_delegate.cc
+ EncodingMenuController encoding_controller;
+ if (encoding_controller.DoesCommandBelongToEncodingMenu(tag)) {
+ DCHECK(browser_.get());
+ Profile *profile = browser_->profile();
+ DCHECK(profile);
+ TabContents* current_tab = browser_->GetSelectedTabContents();
+ if (!current_tab) {
+ return;
+ }
+ const std::wstring encoding = current_tab->encoding();
+
+ bool toggled = encoding_controller.IsItemChecked(profile, encoding, tag);
+ NSInteger oldState = [item state];
+ NSInteger newState = toggled ? NSOnState : NSOffState;
+ if (oldState != newState)
+ [item setState:newState];
+ }
+
}
// Called to validate menu and toolbar items when this window is key. All the