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/extensions/application_launch.h" | 5 #include "chrome/browser/ui/extensions/application_launch.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "chrome/browser/extensions/default_apps_trial.h" | 10 #include "chrome/browser/extensions/default_apps_trial.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 ExtensionPrefs::LaunchType launch_type = | 118 ExtensionPrefs::LaunchType launch_type = |
119 profile->GetExtensionService()->extension_prefs()->GetLaunchType( | 119 profile->GetExtensionService()->extension_prefs()->GetLaunchType( |
120 extension->id(), ExtensionPrefs::LAUNCH_DEFAULT); | 120 extension->id(), ExtensionPrefs::LAUNCH_DEFAULT); |
121 if (launch_type == ExtensionPrefs::LAUNCH_FULLSCREEN) | 121 if (launch_type == ExtensionPrefs::LAUNCH_FULLSCREEN) |
122 params.initial_show_state = ui::SHOW_STATE_MAXIMIZED; | 122 params.initial_show_state = ui::SHOW_STATE_MAXIMIZED; |
123 else if (launch_type == ExtensionPrefs::LAUNCH_WINDOW) | 123 else if (launch_type == ExtensionPrefs::LAUNCH_WINDOW) |
124 params.initial_show_state = ui::SHOW_STATE_NORMAL; | 124 params.initial_show_state = ui::SHOW_STATE_NORMAL; |
125 } | 125 } |
126 #endif | 126 #endif |
127 | 127 |
128 Browser* browser = Browser::CreateWithParams(params); | 128 Browser* browser = new Browser(params); |
129 | 129 |
130 if (app_browser) | 130 if (app_browser) |
131 *app_browser = browser; | 131 *app_browser = browser; |
132 | 132 |
133 TabContents* tab_contents = chrome::AddSelectedTabWithURL( | 133 TabContents* tab_contents = chrome::AddSelectedTabWithURL( |
134 browser, url, content::PAGE_TRANSITION_START_PAGE); | 134 browser, url, content::PAGE_TRANSITION_START_PAGE); |
135 WebContents* contents = tab_contents->web_contents(); | 135 WebContents* contents = tab_contents->web_contents(); |
136 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 136 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
137 contents->GetRenderViewHost()->SyncRendererPrefs(); | 137 contents->GetRenderViewHost()->SyncRendererPrefs(); |
138 // TODO(stevenjb): Find the right centralized place to do this. Currently it | 138 // TODO(stevenjb): Find the right centralized place to do this. Currently it |
(...skipping 12 matching lines...) Expand all Loading... |
151 } | 151 } |
152 | 152 |
153 WebContents* OpenApplicationTab(Profile* profile, | 153 WebContents* OpenApplicationTab(Profile* profile, |
154 const Extension* extension, | 154 const Extension* extension, |
155 const GURL& override_url, | 155 const GURL& override_url, |
156 WindowOpenDisposition disposition) { | 156 WindowOpenDisposition disposition) { |
157 Browser* browser = browser::FindTabbedBrowser(profile, false); | 157 Browser* browser = browser::FindTabbedBrowser(profile, false); |
158 WebContents* contents = NULL; | 158 WebContents* contents = NULL; |
159 if (!browser) { | 159 if (!browser) { |
160 // No browser for this profile, need to open a new one. | 160 // No browser for this profile, need to open a new one. |
161 browser = Browser::Create(profile); | 161 browser = new Browser(Browser::CreateParams(profile)); |
162 browser->window()->Show(); | 162 browser->window()->Show(); |
163 // There's no current tab in this browser window, so add a new one. | 163 // There's no current tab in this browser window, so add a new one. |
164 disposition = NEW_FOREGROUND_TAB; | 164 disposition = NEW_FOREGROUND_TAB; |
165 } else { | 165 } else { |
166 // For existing browser, ensure its window is activated. | 166 // For existing browser, ensure its window is activated. |
167 browser->window()->Activate(); | 167 browser->window()->Activate(); |
168 } | 168 } |
169 | 169 |
170 // Check the prefs for overridden mode. | 170 // Check the prefs for overridden mode. |
171 ExtensionService* extension_service = profile->GetExtensionService(); | 171 ExtensionService* extension_service = profile->GetExtensionService(); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 // OnDidGetApplicationInfo, which calls | 342 // OnDidGetApplicationInfo, which calls |
343 // web_app::UpdateShortcutForTabContents when it sees UPDATE_SHORTCUT as | 343 // web_app::UpdateShortcutForTabContents when it sees UPDATE_SHORTCUT as |
344 // pending web app action. | 344 // pending web app action. |
345 tab_contents->extension_tab_helper()->set_pending_web_app_action( | 345 tab_contents->extension_tab_helper()->set_pending_web_app_action( |
346 extensions::TabHelper::UPDATE_SHORTCUT); | 346 extensions::TabHelper::UPDATE_SHORTCUT); |
347 | 347 |
348 return tab; | 348 return tab; |
349 } | 349 } |
350 | 350 |
351 } // namespace application_launch | 351 } // namespace application_launch |
OLD | NEW |