Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: chrome/browser/cocoa/browser_window_cocoa.mm

Issue 418040: Mac: Implement profile error dialog. (Closed)
Patch Set: done Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #include "app/l10n_util_mac.h"
5 #include "base/gfx/rect.h" 6 #include "base/gfx/rect.h"
6 #include "base/logging.h" 7 #include "base/logging.h"
7 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
8 #include "chrome/app/chrome_dll_resource.h" 9 #include "chrome/app/chrome_dll_resource.h"
9 #include "chrome/browser/bookmarks/bookmark_utils.h" 10 #include "chrome/browser/bookmarks/bookmark_utils.h"
11 #include "chrome/browser/browser_list.h"
10 #include "chrome/browser/cocoa/browser_window_cocoa.h" 12 #include "chrome/browser/cocoa/browser_window_cocoa.h"
11 #import "chrome/browser/cocoa/browser_window_controller.h" 13 #import "chrome/browser/cocoa/browser_window_controller.h"
12 #import "chrome/browser/cocoa/bug_report_window_controller.h" 14 #import "chrome/browser/cocoa/bug_report_window_controller.h"
13 #import "chrome/browser/cocoa/clear_browsing_data_controller.h" 15 #import "chrome/browser/cocoa/clear_browsing_data_controller.h"
14 #import "chrome/browser/cocoa/download_shelf_controller.h" 16 #import "chrome/browser/cocoa/download_shelf_controller.h"
15 #import "chrome/browser/cocoa/html_dialog_window_controller.h" 17 #import "chrome/browser/cocoa/html_dialog_window_controller.h"
16 #import "chrome/browser/cocoa/import_settings_dialog.h" 18 #import "chrome/browser/cocoa/import_settings_dialog.h"
17 #import "chrome/browser/cocoa/keyword_editor_cocoa_controller.h" 19 #import "chrome/browser/cocoa/keyword_editor_cocoa_controller.h"
18 #import "chrome/browser/cocoa/nsmenuitem_additions.h" 20 #import "chrome/browser/cocoa/nsmenuitem_additions.h"
19 #include "chrome/browser/cocoa/page_info_window_mac.h" 21 #include "chrome/browser/cocoa/page_info_window_mac.h"
20 #include "chrome/browser/cocoa/repost_form_warning_mac.h" 22 #include "chrome/browser/cocoa/repost_form_warning_mac.h"
21 #include "chrome/browser/cocoa/status_bubble_mac.h" 23 #include "chrome/browser/cocoa/status_bubble_mac.h"
22 #include "chrome/browser/cocoa/task_manager_mac.h" 24 #include "chrome/browser/cocoa/task_manager_mac.h"
23 #import "chrome/browser/cocoa/theme_install_bubble_view.h" 25 #import "chrome/browser/cocoa/theme_install_bubble_view.h"
24 #include "chrome/browser/browser.h" 26 #include "chrome/browser/browser.h"
25 #include "chrome/browser/download/download_shelf.h" 27 #include "chrome/browser/download/download_shelf.h"
26 #include "chrome/browser/global_keyboard_shortcuts_mac.h" 28 #include "chrome/browser/global_keyboard_shortcuts_mac.h"
27 #include "chrome/common/notification_service.h" 29 #include "chrome/common/notification_service.h"
28 #include "chrome/common/pref_names.h" 30 #include "chrome/common/pref_names.h"
29 #include "chrome/common/pref_service.h" 31 #include "chrome/common/pref_service.h"
30 #include "chrome/common/temp_scaffolding_stubs.h" 32 #include "chrome/common/temp_scaffolding_stubs.h"
31 #include "chrome/browser/profile.h" 33 #include "chrome/browser/profile.h"
34 #include "grit/chromium_strings.h"
35 #include "grit/generated_resources.h"
32 36
33 BrowserWindowCocoa::BrowserWindowCocoa(Browser* browser, 37 BrowserWindowCocoa::BrowserWindowCocoa(Browser* browser,
34 BrowserWindowController* controller, 38 BrowserWindowController* controller,
35 NSWindow* window) 39 NSWindow* window)
36 : window_(window), 40 : window_(window),
37 browser_(browser), 41 browser_(browser),
38 controller_(controller) { 42 controller_(controller) {
39 // This pref applies to all windows, so all must watch for it. 43 // This pref applies to all windows, so all must watch for it.
40 registrar_.Add(this, NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, 44 registrar_.Add(this, NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
41 NotificationService::AllSources()); 45 NotificationService::AllSources());
42 } 46 }
43 47
44 BrowserWindowCocoa::~BrowserWindowCocoa() { 48 BrowserWindowCocoa::~BrowserWindowCocoa() {
45 } 49 }
46 50
47 void BrowserWindowCocoa::Show() { 51 void BrowserWindowCocoa::Show() {
52 // The Browser associated with this browser window must become the active
53 // browser at the time Show() is called. This is the natural behaviour under
viettrungluu 2009/11/21 07:32:38 That should be "|Show()|", I suppose.
54 // Windows, but |makeKeyAndOrderFront:| won't send |windowDidBecomeMain:|
viettrungluu 2009/11/21 07:32:38 One day (apparently today), I'll point out that th
55 // until we return to the runloop. Therefore any calls to
56 // BrowserList::GetLastActive() (for example, in bookmark_util), will return
viettrungluu 2009/11/21 07:32:38 |...| here to.
57 // the previous browser instead if we don't explicitly set it here.
58 BrowserList::SetLastActive(browser_);
59
48 [window_ makeKeyAndOrderFront:controller_]; 60 [window_ makeKeyAndOrderFront:controller_];
49 } 61 }
50 62
51 void BrowserWindowCocoa::SetBounds(const gfx::Rect& bounds) { 63 void BrowserWindowCocoa::SetBounds(const gfx::Rect& bounds) {
52 NSRect cocoa_bounds = NSMakeRect(bounds.x(), 0, bounds.width(), 64 NSRect cocoa_bounds = NSMakeRect(bounds.x(), 0, bounds.width(),
53 bounds.height()); 65 bounds.height());
54 // Flip coordinates based on the primary screen. 66 // Flip coordinates based on the primary screen.
55 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; 67 NSScreen* screen = [[NSScreen screens] objectAtIndex:0];
56 cocoa_bounds.origin.y = 68 cocoa_bounds.origin.y =
57 [screen frame].size.height - bounds.height() - bounds.y(); 69 [screen frame].size.height - bounds.height() - bounds.y();
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 void BrowserWindowCocoa::ShowNewProfileDialog() { 308 void BrowserWindowCocoa::ShowNewProfileDialog() {
297 NOTIMPLEMENTED(); 309 NOTIMPLEMENTED();
298 } 310 }
299 311
300 void BrowserWindowCocoa::ShowRepostFormWarningDialog( 312 void BrowserWindowCocoa::ShowRepostFormWarningDialog(
301 TabContents* tab_contents) { 313 TabContents* tab_contents) {
302 new RepostFormWarningMac(GetNativeHandle(), &tab_contents->controller()); 314 new RepostFormWarningMac(GetNativeHandle(), &tab_contents->controller());
303 } 315 }
304 316
305 void BrowserWindowCocoa::ShowProfileErrorDialog(int message_id) { 317 void BrowserWindowCocoa::ShowProfileErrorDialog(int message_id) {
306 NOTIMPLEMENTED(); 318 scoped_nsobject<NSAlert> alert([[NSAlert alloc] init]);
319 [alert addButtonWithTitle:l10n_util::GetNSStringWithFixup(IDS_OK)];
320 [alert setMessageText:l10n_util::GetNSStringWithFixup(IDS_PRODUCT_NAME)];
321 [alert setInformativeText:l10n_util::GetNSStringWithFixup(message_id)];
322 [alert setAlertStyle:NSWarningAlertStyle];
323 [alert runModal];
307 } 324 }
308 325
309 void BrowserWindowCocoa::ShowThemeInstallBubble() { 326 void BrowserWindowCocoa::ShowThemeInstallBubble() {
310 ThemeInstallBubbleView::Show(window_); 327 ThemeInstallBubbleView::Show(window_);
311 } 328 }
312 329
313 // We allow closing the window here since the real quit decision on Mac is made 330 // We allow closing the window here since the real quit decision on Mac is made
314 // in [AppController quit:]. 331 // in [AppController quit:].
315 void BrowserWindowCocoa::ConfirmBrowserCloseWithPendingDownloads() { 332 void BrowserWindowCocoa::ConfirmBrowserCloseWithPendingDownloads() {
316 browser_->InProgressDownloadResponse(true); 333 browser_->InProgressDownloadResponse(true);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 break; 451 break;
435 } 452 }
436 } 453 }
437 454
438 void BrowserWindowCocoa::DestroyBrowser() { 455 void BrowserWindowCocoa::DestroyBrowser() {
439 [controller_ destroyBrowser]; 456 [controller_ destroyBrowser];
440 457
441 // at this point the controller is dead (autoreleased), so 458 // at this point the controller is dead (autoreleased), so
442 // make sure we don't try to reference it any more. 459 // make sure we don't try to reference it any more.
443 } 460 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698