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

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

Issue 1300763002: Add a flag to enable open in window for hosted apps on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@disable-new-bookmark-apps
Patch Set: Launch logic in app info summary panel Created 5 years, 4 months 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
OLDNEW
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
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 if (extensions::util::CanHostedAppsOpenInWindows())
tapted 2015/08/19 06:48:13 nit: comment here like "Omit the Open As Window ch
dominickn 2015/08/19 07:10:41 Done.
587 [view addSubview:open_as_window_checkbox];
586 [view addSubview:app_title]; 588 [view addSubview:app_title];
587 [alert setAccessoryView:view]; 589 [alert setAccessoryView:view];
588 590
589 // Find the image with target size. 591 // Find the image with target size.
590 // Assumes that the icons are sorted in ascending order of size. 592 // Assumes that the icons are sorted in ascending order of size.
591 if (!web_app_info.icons.empty()) { 593 if (!web_app_info.icons.empty()) {
592 for (const WebApplicationInfo::IconInfo& info : web_app_info.icons) { 594 for (const WebApplicationInfo::IconInfo& info : web_app_info.icons) {
593 if (info.width == kIconPreviewTargetSize && 595 if (info.width == kIconPreviewTargetSize &&
594 info.height == kIconPreviewTargetSize) { 596 info.height == kIconPreviewTargetSize) {
595 gfx::Image icon_image = gfx::Image::CreateFrom1xBitmap(info.data); 597 gfx::Image icon_image = gfx::Image::CreateFrom1xBitmap(info.data);
596 [alert setIcon:icon_image.ToNSImage()]; 598 [alert setIcon:icon_image.ToNSImage()];
597 break; 599 break;
598 } 600 }
599 } 601 }
600 } 602 }
601 603
602 NSInteger response = [alert runModal]; 604 NSInteger response = [alert runModal];
603 605
604 // Prevent |app_title| from accessing |delegate| after it's destroyed. 606 // Prevent |app_title| from accessing |delegate| after it's destroyed.
605 [app_title setDelegate:nil]; 607 [app_title setDelegate:nil];
606 608
607 if (response == NSAlertFirstButtonReturn) { 609 if (response == NSAlertFirstButtonReturn) {
608 WebApplicationInfo updated_info = web_app_info; 610 WebApplicationInfo updated_info = web_app_info;
609 updated_info.open_as_window = [open_as_window_checkbox state] == NSOnState; 611 if (extensions::util::CanHostedAppsOpenInWindows()) {
tapted 2015/08/19 06:48:13 Is this to address something specific? (I think we
dominickn 2015/08/19 07:10:41 Digging deeper, it looks like it doesn't doesn't h
612 updated_info.open_as_window =
613 [open_as_window_checkbox state] == NSOnState;
614 }
610 updated_info.title = TrimText([app_title stringValue]); 615 updated_info.title = TrimText([app_title stringValue]);
611 616
612 callback.Run(true, updated_info); 617 callback.Run(true, updated_info);
613 return; 618 return;
614 } 619 }
615 620
616 callback.Run(false, web_app_info); 621 callback.Run(false, web_app_info);
617 } 622 }
618 623
619 void BrowserWindowCocoa::ShowTranslateBubble( 624 void BrowserWindowCocoa::ShowTranslateBubble(
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698