OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #import "chrome/browser/app_controller_mac.h" | 5 #import "chrome/browser/app_controller_mac.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 #include "chrome/common/chrome_switches.h" | 56 #include "chrome/common/chrome_switches.h" |
57 #include "chrome/common/mac/app_mode_common.h" | 57 #include "chrome/common/mac/app_mode_common.h" |
58 #include "chrome/common/pref_names.h" | 58 #include "chrome/common/pref_names.h" |
59 #include "chrome/common/service_messages.h" | 59 #include "chrome/common/service_messages.h" |
60 #include "chrome/common/url_constants.h" | 60 #include "chrome/common/url_constants.h" |
61 #include "content/browser/browser_thread.h" | 61 #include "content/browser/browser_thread.h" |
62 #include "content/browser/download/download_manager.h" | 62 #include "content/browser/download/download_manager.h" |
63 #include "content/browser/tab_contents/tab_contents.h" | 63 #include "content/browser/tab_contents/tab_contents.h" |
64 #include "content/browser/user_metrics.h" | 64 #include "content/browser/user_metrics.h" |
65 #include "content/common/cloud_print_class_mac.h" | 65 #include "content/common/cloud_print_class_mac.h" |
66 #include "content/common/notification_service.h" | 66 #include "content/public/browser/notification_service.h" |
67 #include "content/public/browser/notification_types.h" | 67 #include "content/public/browser/notification_types.h" |
68 #include "grit/chromium_strings.h" | 68 #include "grit/chromium_strings.h" |
69 #include "grit/generated_resources.h" | 69 #include "grit/generated_resources.h" |
70 #include "net/base/net_util.h" | 70 #include "net/base/net_util.h" |
71 #include "ui/base/l10n/l10n_util.h" | 71 #include "ui/base/l10n/l10n_util.h" |
72 #include "ui/base/l10n/l10n_util_mac.h" | 72 #include "ui/base/l10n/l10n_util_mac.h" |
73 #include "ui/base/models/accelerator_cocoa.h" | 73 #include "ui/base/models/accelerator_cocoa.h" |
74 | 74 |
75 // 10.6 adds a public API for the Spotlight-backed search menu item in the Help | 75 // 10.6 adds a public API for the Spotlight-backed search menu item in the Help |
76 // menu. Provide the declaration so it can be called below when building with | 76 // menu. Provide the declaration so it can be called below when building with |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 bookmarkMenuBridge_->BuildMenu(); | 501 bookmarkMenuBridge_->BuildMenu(); |
502 | 502 |
503 historyMenuBridge_.reset(new HistoryMenuBridge(lastProfile_)); | 503 historyMenuBridge_.reset(new HistoryMenuBridge(lastProfile_)); |
504 historyMenuBridge_->BuildMenu(); | 504 historyMenuBridge_->BuildMenu(); |
505 } | 505 } |
506 | 506 |
507 - (void)checkForAnyKeyWindows { | 507 - (void)checkForAnyKeyWindows { |
508 if ([NSApp keyWindow]) | 508 if ([NSApp keyWindow]) |
509 return; | 509 return; |
510 | 510 |
511 NotificationService::current()->Notify( | 511 content::NotificationService::current()->Notify( |
512 content::NOTIFICATION_NO_KEY_WINDOW, | 512 content::NOTIFICATION_NO_KEY_WINDOW, |
513 NotificationService::AllSources(), | 513 content::NotificationService::AllSources(), |
514 NotificationService::NoDetails()); | 514 content::NotificationService::NoDetails()); |
515 } | 515 } |
516 | 516 |
517 // If the auto-update interval is not set, make it 5 hours. | 517 // If the auto-update interval is not set, make it 5 hours. |
518 // This code is specific to Mac Chrome Dev Channel. | 518 // This code is specific to Mac Chrome Dev Channel. |
519 // Placed here for 2 reasons: | 519 // Placed here for 2 reasons: |
520 // 1) Same spot as other Pref stuff | 520 // 1) Same spot as other Pref stuff |
521 // 2) Try and be friendly by keeping this after app launch | 521 // 2) Try and be friendly by keeping this after app launch |
522 // TODO(jrg): remove once we go Beta. | 522 // TODO(jrg): remove once we go Beta. |
523 - (void)setUpdateCheckInterval { | 523 - (void)setUpdateCheckInterval { |
524 #if defined(GOOGLE_CHROME_BUILD) | 524 #if defined(GOOGLE_CHROME_BUILD) |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 | 577 |
578 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 578 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
579 if (!parsed_command_line.HasSwitch(switches::kEnableExposeForTabs)) { | 579 if (!parsed_command_line.HasSwitch(switches::kEnableExposeForTabs)) { |
580 [tabposeMenuItem_ setHidden:YES]; | 580 [tabposeMenuItem_ setHidden:YES]; |
581 } | 581 } |
582 } | 582 } |
583 | 583 |
584 // This is called after profiles have been loaded and preferences registered. | 584 // This is called after profiles have been loaded and preferences registered. |
585 // It is safe to access the default profile here. | 585 // It is safe to access the default profile here. |
586 - (void)applicationDidBecomeActive:(NSNotification*)notify { | 586 - (void)applicationDidBecomeActive:(NSNotification*)notify { |
587 NotificationService::current()->Notify(content::NOTIFICATION_APP_ACTIVATED, | 587 content::NotificationService::current()->Notify( |
588 NotificationService::AllSources(), | 588 content::NOTIFICATION_APP_ACTIVATED, |
589 NotificationService::NoDetails()); | 589 content::NotificationService::AllSources(), |
| 590 content::NotificationService::NoDetails()); |
590 } | 591 } |
591 | 592 |
592 // Helper function for populating and displaying the in progress downloads at | 593 // Helper function for populating and displaying the in progress downloads at |
593 // exit alert panel. | 594 // exit alert panel. |
594 - (BOOL)userWillWaitForInProgressDownloads:(int)downloadCount { | 595 - (BOOL)userWillWaitForInProgressDownloads:(int)downloadCount { |
595 NSString* warningText = nil; | 596 NSString* warningText = nil; |
596 NSString* explanationText = nil; | 597 NSString* explanationText = nil; |
597 NSString* waitTitle = nil; | 598 NSString* waitTitle = nil; |
598 NSString* exitTitle = nil; | 599 NSString* exitTitle = nil; |
599 | 600 |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1282 | 1283 |
1283 } // namespace browser | 1284 } // namespace browser |
1284 | 1285 |
1285 namespace app_controller_mac { | 1286 namespace app_controller_mac { |
1286 | 1287 |
1287 bool IsOpeningNewWindow() { | 1288 bool IsOpeningNewWindow() { |
1288 return g_is_opening_new_window; | 1289 return g_is_opening_new_window; |
1289 } | 1290 } |
1290 | 1291 |
1291 } // namespace app_controller_mac | 1292 } // namespace app_controller_mac |
OLD | NEW |