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

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 10197003: ash: Ensure LAUNCH_WINDOW opens in normal window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
« 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) 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/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // OS_WIN 10 #endif // OS_WIN
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 770
771 gfx::Rect window_bounds; 771 gfx::Rect window_bounds;
772 if (extension) { 772 if (extension) {
773 window_bounds.set_width(extension->launch_width()); 773 window_bounds.set_width(extension->launch_width());
774 window_bounds.set_height(extension->launch_height()); 774 window_bounds.set_height(extension->launch_height());
775 } 775 }
776 776
777 CreateParams params(type, profile); 777 CreateParams params(type, profile);
778 params.app_name = app_name; 778 params.app_name = app_name;
779 params.initial_bounds = window_bounds; 779 params.initial_bounds = window_bounds;
780
781 #if defined(USE_ASH)
782 if (extension &&
783 container == extension_misc::LAUNCH_WINDOW) {
784 // In ash, LAUNCH_FULLSCREEN launches in a maximized app window and
785 // LAUNCH_WINDOW launches in a normal app window.
786 ExtensionPrefs::LaunchType launch_type =
787 profile->GetExtensionService()->extension_prefs()->GetLaunchType(
788 extension->id(), ExtensionPrefs::LAUNCH_DEFAULT);
789 if (launch_type == ExtensionPrefs::LAUNCH_FULLSCREEN)
790 params.initial_show_state = ui::SHOW_STATE_MAXIMIZED;
791 else if (launch_type == ExtensionPrefs::LAUNCH_WINDOW)
792 params.initial_show_state = ui::SHOW_STATE_NORMAL;
793 }
794 #endif
795
780 Browser* browser = Browser::CreateWithParams(params); 796 Browser* browser = Browser::CreateWithParams(params);
781 797
782 if (app_browser) 798 if (app_browser)
783 *app_browser = browser; 799 *app_browser = browser;
784 800
785 TabContentsWrapper* wrapper = 801 TabContentsWrapper* wrapper =
786 browser->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_START_PAGE); 802 browser->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_START_PAGE);
787 WebContents* contents = wrapper->web_contents(); 803 WebContents* contents = wrapper->web_contents();
788 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; 804 contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
789 contents->GetRenderViewHost()->SyncRendererPrefs(); 805 contents->GetRenderViewHost()->SyncRendererPrefs();
790 // TODO(stevenjb): Find the right centralized place to do this. Currently it 806 // TODO(stevenjb): Find the right centralized place to do this. Currently it
791 // is only done for app tabs in normal browsers through SetExtensionAppById. 807 // is only done for app tabs in normal browsers through SetExtensionAppById.
792 if (extension && type == TYPE_PANEL) 808 if (extension && type == TYPE_PANEL)
793 wrapper->extension_tab_helper()->SetExtensionAppIconById(extension->id()); 809 wrapper->extension_tab_helper()->SetExtensionAppIconById(extension->id());
794 810
795 #if defined(USE_ASH)
796 if (extension &&
797 container == extension_misc::LAUNCH_WINDOW) {
798 // In ash, LAUNCH_FULLSCREEN launches in a maximized app window.
799 ExtensionPrefs::LaunchType launch_type =
800 profile->GetExtensionService()->extension_prefs()->GetLaunchType(
801 extension->id(), ExtensionPrefs::LAUNCH_DEFAULT);
802 if (launch_type == ExtensionPrefs::LAUNCH_FULLSCREEN)
803 browser->window()->Maximize();
804 }
805 #endif
806
807 browser->window()->Show(); 811 browser->window()->Show();
808 812
809 // TODO(jcampan): http://crbug.com/8123 we should not need to set the initial 813 // TODO(jcampan): http://crbug.com/8123 we should not need to set the initial
810 // focus explicitly. 814 // focus explicitly.
811 contents->GetView()->SetInitialFocus(); 815 contents->GetView()->SetInitialFocus();
812 return contents; 816 return contents;
813 } 817 }
814 818
815 WebContents* Browser::OpenAppShortcutWindow(Profile* profile, 819 WebContents* Browser::OpenAppShortcutWindow(Profile* profile,
816 const GURL& url, 820 const GURL& url,
(...skipping 4679 matching lines...) Expand 10 before | Expand all | Expand 10 after
5496 if (contents && !allow_js_access) { 5500 if (contents && !allow_js_access) {
5497 contents->web_contents()->GetController().LoadURL( 5501 contents->web_contents()->GetController().LoadURL(
5498 target_url, 5502 target_url,
5499 content::Referrer(), 5503 content::Referrer(),
5500 content::PAGE_TRANSITION_LINK, 5504 content::PAGE_TRANSITION_LINK,
5501 std::string()); // No extra headers. 5505 std::string()); // No extra headers.
5502 } 5506 }
5503 5507
5504 return contents != NULL; 5508 return contents != NULL;
5505 } 5509 }
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