| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/browser.h" | 5 #include "chrome/browser/browser.h" |
| 6 | 6 |
| 7 #include "app/animation.h" | 7 #include "app/animation.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/gfx/point.h" | 10 #include "base/gfx/point.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 } | 222 } |
| 223 | 223 |
| 224 void Browser::CreateBrowserWindow() { | 224 void Browser::CreateBrowserWindow() { |
| 225 DCHECK(!window_); | 225 DCHECK(!window_); |
| 226 | 226 |
| 227 if (SupportsWindowFeature(FEATURE_EXTENSIONSHELF)) | 227 if (SupportsWindowFeature(FEATURE_EXTENSIONSHELF)) |
| 228 extension_shelf_model_.reset(new ExtensionShelfModel(this)); | 228 extension_shelf_model_.reset(new ExtensionShelfModel(this)); |
| 229 | 229 |
| 230 window_ = BrowserWindow::CreateBrowserWindow(this); | 230 window_ = BrowserWindow::CreateBrowserWindow(this); |
| 231 | 231 |
| 232 #if defined(OS_WIN) |
| 233 // Set the app user model id for this application to that of the application |
| 234 // name. See http://crbug.com/7028. |
| 235 win_util::SetAppIdForWindow(type_ & TYPE_APP ? app_name_ : |
| 236 l10n_util::GetString(IDS_PRODUCT_NAME), |
| 237 window()->GetNativeHandle()); |
| 238 #endif |
| 239 |
| 232 NotificationService::current()->Notify( | 240 NotificationService::current()->Notify( |
| 233 NotificationType::BROWSER_WINDOW_READY, | 241 NotificationType::BROWSER_WINDOW_READY, |
| 234 Source<Browser>(this), | 242 Source<Browser>(this), |
| 235 NotificationService::NoDetails()); | 243 NotificationService::NoDetails()); |
| 236 | 244 |
| 237 // Show the First Run information bubble if we've been told to. | 245 // Show the First Run information bubble if we've been told to. |
| 238 PrefService* local_state = g_browser_process->local_state(); | 246 PrefService* local_state = g_browser_process->local_state(); |
| 239 if (!local_state) | 247 if (!local_state) |
| 240 return; | 248 return; |
| 241 if (local_state->IsPrefRegistered(prefs::kShouldShowFirstRunBubble) && | 249 if (local_state->IsPrefRegistered(prefs::kShouldShowFirstRunBubble) && |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 | 317 |
| 310 // static | 318 // static |
| 311 void Browser::OpenApplicationWindow(Profile* profile, const GURL& url) { | 319 void Browser::OpenApplicationWindow(Profile* profile, const GURL& url) { |
| 312 std::wstring app_name = ComputeApplicationNameFromURL(url); | 320 std::wstring app_name = ComputeApplicationNameFromURL(url); |
| 313 RegisterAppPrefs(app_name); | 321 RegisterAppPrefs(app_name); |
| 314 | 322 |
| 315 Browser* browser = Browser::CreateForApp(app_name, profile, false); | 323 Browser* browser = Browser::CreateForApp(app_name, profile, false); |
| 316 browser->AddTabWithURL(url, GURL(), PageTransition::START_PAGE, true, -1, | 324 browser->AddTabWithURL(url, GURL(), PageTransition::START_PAGE, true, -1, |
| 317 false, NULL); | 325 false, NULL); |
| 318 | 326 |
| 319 #if defined(OS_WIN) | |
| 320 // Set the app user model id for this application to that of the application | |
| 321 // name. See http://crbug.com/7028. | |
| 322 win_util::SetAppIdForWindow(app_name, browser->window()->GetNativeHandle()); | |
| 323 #endif | |
| 324 | |
| 325 TabContents* tab_contents = browser->GetSelectedTabContents(); | 327 TabContents* tab_contents = browser->GetSelectedTabContents(); |
| 326 tab_contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 328 tab_contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
| 327 tab_contents->render_view_host()->SyncRendererPrefs(); | 329 tab_contents->render_view_host()->SyncRendererPrefs(); |
| 328 browser->window()->Show(); | 330 browser->window()->Show(); |
| 329 // TODO(jcampan): http://crbug.com/8123 we should not need to set the initial | 331 // TODO(jcampan): http://crbug.com/8123 we should not need to set the initial |
| 330 // focus explicitly. | 332 // focus explicitly. |
| 331 tab_contents->view()->SetInitialFocus(); | 333 tab_contents->view()->SetInitialFocus(); |
| 332 } | 334 } |
| 333 | 335 |
| 334 #if defined(OS_MACOSX) | 336 #if defined(OS_MACOSX) |
| (...skipping 2689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3024 /////////////////////////////////////////////////////////////////////////////// | 3026 /////////////////////////////////////////////////////////////////////////////// |
| 3025 // BrowserToolbarModel (private): | 3027 // BrowserToolbarModel (private): |
| 3026 | 3028 |
| 3027 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { | 3029 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { |
| 3028 // This |current_tab| can be NULL during the initialization of the | 3030 // This |current_tab| can be NULL during the initialization of the |
| 3029 // toolbar during window creation (i.e. before any tabs have been added | 3031 // toolbar during window creation (i.e. before any tabs have been added |
| 3030 // to the window). | 3032 // to the window). |
| 3031 TabContents* current_tab = browser_->GetSelectedTabContents(); | 3033 TabContents* current_tab = browser_->GetSelectedTabContents(); |
| 3032 return current_tab ? ¤t_tab->controller() : NULL; | 3034 return current_tab ? ¤t_tab->controller() : NULL; |
| 3033 } | 3035 } |
| OLD | NEW |