summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-21 07:44:29 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-21 07:44:29 +0000
commit4d409d77dfaa84a06547d3e0a45191cf803fbb9d (patch)
tree4346c30854e63f5632544efc35582f6fa567a465 /chrome/browser
parent150b0549fc50eec51e68f1c1cdf0d43be0fa2716 (diff)
downloadchromium_src-4d409d77dfaa84a06547d3e0a45191cf803fbb9d.zip
chromium_src-4d409d77dfaa84a06547d3e0a45191cf803fbb9d.tar.gz
chromium_src-4d409d77dfaa84a06547d3e0a45191cf803fbb9d.tar.bz2
Mac: Implement profile error dialog.
The "active window" change was done for linux in http://codereview.chromium.org/147091 and might fix other problems too. Without this, BrowserList::GetLastActive() returns NULL in Browser::Observe(), which caused the new function not to be called. It looks something like http://imgur.com/6PHQm . BUG=26377 TEST= chmod -r ~/Library/Application\ Support/Chromium/Default/History* Then start chromium (release build, so that we survive some sqlite dchecks) and make sure it displays an error message (then chmod +r again) Review URL: http://codereview.chromium.org/418040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32738 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/cocoa/browser_window_cocoa.mm19
1 files changed, 18 insertions, 1 deletions
diff --git a/chrome/browser/cocoa/browser_window_cocoa.mm b/chrome/browser/cocoa/browser_window_cocoa.mm
index d7d19d5..2d48ebd 100644
--- a/chrome/browser/cocoa/browser_window_cocoa.mm
+++ b/chrome/browser/cocoa/browser_window_cocoa.mm
@@ -2,11 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "app/l10n_util_mac.h"
#include "base/gfx/rect.h"
#include "base/logging.h"
#include "base/sys_string_conversions.h"
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/bookmarks/bookmark_utils.h"
+#include "chrome/browser/browser_list.h"
#include "chrome/browser/cocoa/browser_window_cocoa.h"
#import "chrome/browser/cocoa/browser_window_controller.h"
#import "chrome/browser/cocoa/bug_report_window_controller.h"
@@ -29,6 +31,8 @@
#include "chrome/common/pref_service.h"
#include "chrome/common/temp_scaffolding_stubs.h"
#include "chrome/browser/profile.h"
+#include "grit/chromium_strings.h"
+#include "grit/generated_resources.h"
BrowserWindowCocoa::BrowserWindowCocoa(Browser* browser,
BrowserWindowController* controller,
@@ -45,6 +49,14 @@ BrowserWindowCocoa::~BrowserWindowCocoa() {
}
void BrowserWindowCocoa::Show() {
+ // The Browser associated with this browser window must become the active
+ // browser at the time |Show()| is called. This is the natural behaviour under
+ // Windows, but |-makeKeyAndOrderFront:| won't send |-windowDidBecomeMain:|
+ // until we return to the runloop. Therefore any calls to
+ // |BrowserList::GetLastActive()| (for example, in bookmark_util), will return
+ // the previous browser instead if we don't explicitly set it here.
+ BrowserList::SetLastActive(browser_);
+
[window_ makeKeyAndOrderFront:controller_];
}
@@ -303,7 +315,12 @@ void BrowserWindowCocoa::ShowRepostFormWarningDialog(
}
void BrowserWindowCocoa::ShowProfileErrorDialog(int message_id) {
- NOTIMPLEMENTED();
+ scoped_nsobject<NSAlert> alert([[NSAlert alloc] init]);
+ [alert addButtonWithTitle:l10n_util::GetNSStringWithFixup(IDS_OK)];
+ [alert setMessageText:l10n_util::GetNSStringWithFixup(IDS_PRODUCT_NAME)];
+ [alert setInformativeText:l10n_util::GetNSStringWithFixup(message_id)];
+ [alert setAlertStyle:NSWarningAlertStyle];
+ [alert runModal];
}
void BrowserWindowCocoa::ShowThemeInstallBubble() {