Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 508 void BrowserWindowCocoa::ShowUpdateChromeDialog() { | 508 void BrowserWindowCocoa::ShowUpdateChromeDialog() { |
| 509 restart_browser::RequestRestart(window()); | 509 restart_browser::RequestRestart(window()); |
| 510 } | 510 } |
| 511 | 511 |
| 512 void BrowserWindowCocoa::ShowBookmarkBubble(const GURL& url, | 512 void BrowserWindowCocoa::ShowBookmarkBubble(const GURL& url, |
| 513 bool already_bookmarked) { | 513 bool already_bookmarked) { |
| 514 [controller_ showBookmarkBubbleForURL:url | 514 [controller_ showBookmarkBubbleForURL:url |
| 515 alreadyBookmarked:(already_bookmarked ? YES : NO)]; | 515 alreadyBookmarked:(already_bookmarked ? YES : NO)]; |
| 516 } | 516 } |
| 517 | 517 |
| 518 void BrowserWindowCocoa::ShowBookmarkAppBubble( | 518 void BrowserWindowCocoa::ShowBookmarkAppBubble( |
|
benwells
2014/12/15 05:10:09
Comment (i.e. don't worry about it for this CL): i
| |
| 519 const WebApplicationInfo& web_app_info, | 519 const WebApplicationInfo& web_app_info, |
| 520 const std::string& extension_id) { | 520 const std::string& extension_id) { |
| 521 Profile* profile = browser_->profile(); | 521 Profile* profile = browser_->profile(); |
| 522 | 522 |
| 523 base::scoped_nsobject<NSAlert> alert([[NSAlert alloc] init]); | 523 base::scoped_nsobject<NSAlert> alert([[NSAlert alloc] init]); |
| 524 [alert setMessageText:l10n_util::GetNSString(IDS_BOOKMARK_APP_BUBBLE_TITLE)]; | 524 [alert setMessageText:l10n_util::GetNSString(IDS_BOOKMARK_APP_BUBBLE_TITLE)]; |
| 525 [alert setAlertStyle:NSInformationalAlertStyle]; | 525 [alert setAlertStyle:NSInformationalAlertStyle]; |
| 526 | 526 |
| 527 NSButton* continue_button = | 527 NSButton* continue_button = |
| 528 [alert addButtonWithTitle:l10n_util::GetNSString(IDS_OK)]; | 528 [alert addButtonWithTitle:l10n_util::GetNSString(IDS_OK)]; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 581 extensions::SetLaunchType(service, extension_id, launch_type); | 581 extensions::SetLaunchType(service, extension_id, launch_type); |
| 582 | 582 |
| 583 // Update name of app. | 583 // Update name of app. |
| 584 NSString* new_title = [app_title stringValue]; | 584 NSString* new_title = [app_title stringValue]; |
| 585 if (![original_title isEqualToString:new_title]) { | 585 if (![original_title isEqualToString:new_title]) { |
| 586 WebApplicationInfo new_web_app_info(web_app_info); | 586 WebApplicationInfo new_web_app_info(web_app_info); |
| 587 new_web_app_info.title = base::SysNSStringToUTF16(new_title); | 587 new_web_app_info.title = base::SysNSStringToUTF16(new_title); |
| 588 extensions::CreateOrUpdateBookmarkApp(service, &new_web_app_info); | 588 extensions::CreateOrUpdateBookmarkApp(service, &new_web_app_info); |
| 589 } | 589 } |
| 590 | 590 |
| 591 extensions::ExtensionRegistry* registry = | 591 // If we're not creating app shims, no need to reveal it in Finder. |
| 592 extensions::ExtensionRegistry::Get(profile); | 592 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 593 const extensions::Extension* app = registry->GetExtensionById( | 593 switches::kEnableHostedAppShimCreation)) { |
| 594 extension_id, extensions::ExtensionRegistry::ENABLED); | 594 extensions::ExtensionRegistry* registry = |
| 595 extensions::ExtensionRegistry::Get(profile); | |
| 596 const extensions::Extension* app = registry->GetExtensionById( | |
| 597 extension_id, extensions::ExtensionRegistry::ENABLED); | |
| 595 | 598 |
| 596 web_app::RevealAppShimInFinderForApp(profile, app); | 599 web_app::RevealAppShimInFinderForApp(profile, app); |
| 600 } | |
| 597 } else { | 601 } else { |
| 598 service->UninstallExtension(extension_id, | 602 service->UninstallExtension(extension_id, |
| 599 extensions::UNINSTALL_REASON_INSTALL_CANCELED, | 603 extensions::UNINSTALL_REASON_INSTALL_CANCELED, |
| 600 base::Bind(&base::DoNothing), NULL); | 604 base::Bind(&base::DoNothing), NULL); |
| 601 } | 605 } |
| 602 } | 606 } |
| 603 | 607 |
| 604 void BrowserWindowCocoa::ShowTranslateBubble( | 608 void BrowserWindowCocoa::ShowTranslateBubble( |
| 605 content::WebContents* contents, | 609 content::WebContents* contents, |
| 606 translate::TranslateStep step, | 610 translate::TranslateStep step, |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 807 if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED) | 811 if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED) |
| 808 return 0; | 812 return 0; |
| 809 return 40; | 813 return 40; |
| 810 } | 814 } |
| 811 | 815 |
| 812 void BrowserWindowCocoa::ExecuteExtensionCommand( | 816 void BrowserWindowCocoa::ExecuteExtensionCommand( |
| 813 const extensions::Extension* extension, | 817 const extensions::Extension* extension, |
| 814 const extensions::Command& command) { | 818 const extensions::Command& command) { |
| 815 [cocoa_controller() executeExtensionCommand:extension->id() command:command]; | 819 [cocoa_controller() executeExtensionCommand:extension->id() command:command]; |
| 816 } | 820 } |
| OLD | NEW |