summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-15 16:01:47 +0000
committerpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-15 16:01:47 +0000
commite4cfddb3796bacb968607d17024d77540b665ca2 (patch)
tree4a09fe62c2ee81e921c0f790dba0279157666ea5 /chrome
parentf8a7bf5a45ddbab7bd3cd32fbb1a66bba04b2639 (diff)
downloadchromium_src-e4cfddb3796bacb968607d17024d77540b665ca2.zip
chromium_src-e4cfddb3796bacb968607d17024d77540b665ca2.tar.gz
chromium_src-e4cfddb3796bacb968607d17024d77540b665ca2.tar.bz2
Badge browser window with incognito icon when in incognito mode
BUG=12536 TEST=incognito icon on window opened in incognito mode git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18390 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/cocoa/browser_window_controller.mm28
-rw-r--r--chrome/chrome.gyp1
2 files changed, 29 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm
index 99a0737..f363008 100644
--- a/chrome/browser/cocoa/browser_window_controller.mm
+++ b/chrome/browser/cocoa/browser_window_controller.mm
@@ -10,6 +10,7 @@
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/encoding_menu_controller.h"
+#include "chrome/browser/profile.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"
@@ -37,6 +38,7 @@ const int kWindowGradientHeight = 24;
@interface BrowserWindowController(Private)
- (void)positionToolbar;
+- (void)installIncognitoBadge;
// Leopard's gradient heuristic gets confused by our tabs and makes the title
// gradient jump when creating a tab that is less than a tab width from the
@@ -133,6 +135,9 @@ willPositionSheet:(NSWindow *)sheet
switchView:[self tabContentArea]
model:browser_->tabstrip_model()]);
+ // Puts the incognito badge on the window frame, if necessary.
+ [self installIncognitoBadge];
+
// Create a controller for the toolbar, giving it the toolbar model object
// and the toolbar view from the nib. The controller will handle
// registering for the appropriate command state changes from the back-end.
@@ -641,6 +646,29 @@ willPositionSheet:(NSWindow *)sheet
[[[self window] contentView] addSubview:toolbarView];
}
+// If the browser is in incognito mode, install the image view to decordate
+// the window at the upper right. Use the same base y coordinate as the
+// tab strip.
+- (void)installIncognitoBadge {
+ if (!browser_->profile()->IsOffTheRecord())
+ return;
+
+ NSString *incognitoPath = [mac_util::MainAppBundle()
+ pathForResource:@"otr_icon"
+ ofType:@"png"];
+ scoped_nsobject<NSImage> incognitoImage(
+ [[NSImage alloc] initWithContentsOfFile:incognitoPath]);
+ const NSSize imageSize = [incognitoImage size];
+ const NSRect tabFrame = [[self tabStripView] frame];
+ NSRect incognitoFrame = tabFrame;
+ incognitoFrame.origin.x = NSMaxX(incognitoFrame) - imageSize.width;
+ incognitoFrame.size = imageSize;
+ scoped_nsobject<NSImageView> incognitoView(
+ [[NSImageView alloc] initWithFrame:incognitoFrame]);
+ [incognitoView setImage:incognitoImage];
+ [[[[self window] contentView] superview] addSubview:incognitoView.get()];
+}
+
- (void)fixWindowGradient {
NSWindow* win = [self window];
if ([win respondsToSelector:@selector(
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index fc6bd74..1cf14f5 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -2305,6 +2305,7 @@
'app/theme/o2_more.png',
'app/theme/o2_search.png',
'app/theme/o2_star.png',
+ 'app/theme/otr_icon.png',
'app/theme/reload.pdf',
'app/theme/sadtab.png',
'app/theme/star.pdf',