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 #import "base/mac/sdk_forward_declarations.h" | 10 #import "base/mac/sdk_forward_declarations.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
15 #include "chrome/app/chrome_command_ids.h" | 15 #include "chrome/app/chrome_command_ids.h" |
16 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
17 #include "chrome/browser/download/download_shelf.h" | 17 #include "chrome/browser/download/download_shelf.h" |
| 18 #include "chrome/browser/extensions/extension_util.h" |
18 #include "chrome/browser/extensions/tab_helper.h" | 19 #include "chrome/browser/extensions/tab_helper.h" |
19 #include "chrome/browser/fullscreen.h" | 20 #include "chrome/browser/fullscreen.h" |
20 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
21 #include "chrome/browser/shell_integration.h" | 22 #include "chrome/browser/shell_integration.h" |
22 #include "chrome/browser/signin/chrome_signin_helper.h" | 23 #include "chrome/browser/signin/chrome_signin_helper.h" |
23 #include "chrome/browser/translate/chrome_translate_client.h" | 24 #include "chrome/browser/translate/chrome_translate_client.h" |
24 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
25 #include "chrome/browser/ui/browser_command_controller.h" | 26 #include "chrome/browser/ui/browser_command_controller.h" |
26 #include "chrome/browser/ui/browser_commands_mac.h" | 27 #include "chrome/browser/ui/browser_commands_mac.h" |
27 #include "chrome/browser/ui/browser_list.h" | 28 #include "chrome/browser/ui/browser_list.h" |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 [[app_title cell] setScrollable:YES]; | 576 [[app_title cell] setScrollable:YES]; |
576 [app_title setStringValue:original_title]; | 577 [app_title setStringValue:original_title]; |
577 base::scoped_nsobject<TextRequiringDelegate> delegate( | 578 base::scoped_nsobject<TextRequiringDelegate> delegate( |
578 [[TextRequiringDelegate alloc] initWithControl:continue_button | 579 [[TextRequiringDelegate alloc] initWithControl:continue_button |
579 text:[app_title stringValue]]); | 580 text:[app_title stringValue]]); |
580 [app_title setDelegate:delegate]; | 581 [app_title setDelegate:delegate]; |
581 | 582 |
582 base::scoped_nsobject<NSView> view([[NSView alloc] | 583 base::scoped_nsobject<NSView> view([[NSView alloc] |
583 initWithFrame:NSMakeRect(0, 0, kBookmarkAppBubbleViewWidth, | 584 initWithFrame:NSMakeRect(0, 0, kBookmarkAppBubbleViewWidth, |
584 kBookmarkAppBubbleViewHeight)]); | 585 kBookmarkAppBubbleViewHeight)]); |
585 [view addSubview:open_as_window_checkbox]; | 586 |
| 587 // When CanHostedAppsOpenInWindows() returns false, do not show the open as |
| 588 // window checkbox to avoid confusing users. |
| 589 if (extensions::util::CanHostedAppsOpenInWindows()) |
| 590 [view addSubview:open_as_window_checkbox]; |
586 [view addSubview:app_title]; | 591 [view addSubview:app_title]; |
587 [alert setAccessoryView:view]; | 592 [alert setAccessoryView:view]; |
588 | 593 |
589 // Find the image with target size. | 594 // Find the image with target size. |
590 // Assumes that the icons are sorted in ascending order of size. | 595 // Assumes that the icons are sorted in ascending order of size. |
591 if (!web_app_info.icons.empty()) { | 596 if (!web_app_info.icons.empty()) { |
592 for (const WebApplicationInfo::IconInfo& info : web_app_info.icons) { | 597 for (const WebApplicationInfo::IconInfo& info : web_app_info.icons) { |
593 if (info.width == kIconPreviewTargetSize && | 598 if (info.width == kIconPreviewTargetSize && |
594 info.height == kIconPreviewTargetSize) { | 599 info.height == kIconPreviewTargetSize) { |
595 gfx::Image icon_image = gfx::Image::CreateFrom1xBitmap(info.data); | 600 gfx::Image icon_image = gfx::Image::CreateFrom1xBitmap(info.data); |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 void BrowserWindowCocoa::UnhideDownloadShelf() { | 850 void BrowserWindowCocoa::UnhideDownloadShelf() { |
846 GetDownloadShelf()->Unhide(); | 851 GetDownloadShelf()->Unhide(); |
847 } | 852 } |
848 | 853 |
849 void BrowserWindowCocoa::HideDownloadShelf() { | 854 void BrowserWindowCocoa::HideDownloadShelf() { |
850 GetDownloadShelf()->Hide(); | 855 GetDownloadShelf()->Hide(); |
851 StatusBubble* statusBubble = GetStatusBubble(); | 856 StatusBubble* statusBubble = GetStatusBubble(); |
852 if (statusBubble) | 857 if (statusBubble) |
853 statusBubble->Hide(); | 858 statusBubble->Hide(); |
854 } | 859 } |
OLD | NEW |