OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 // static | 468 // static |
469 Browser* Browser::CreateForApp(Type type, | 469 Browser* Browser::CreateForApp(Type type, |
470 const std::string& app_name, | 470 const std::string& app_name, |
471 const gfx::Rect& window_bounds, | 471 const gfx::Rect& window_bounds, |
472 Profile* profile) { | 472 Profile* profile) { |
473 DCHECK(type != TYPE_TABBED); | 473 DCHECK(type != TYPE_TABBED); |
474 DCHECK(!app_name.empty()); | 474 DCHECK(!app_name.empty()); |
475 | 475 |
476 RegisterAppPrefs(app_name, profile); | 476 RegisterAppPrefs(app_name, profile); |
477 | 477 |
| 478 #if !defined(OS_CHROMEOS) || defined(USE_AURA) |
478 if (type == TYPE_PANEL && | 479 if (type == TYPE_PANEL && |
479 CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisablePanels)) { | 480 !PanelManager::ShouldUsePanels( |
| 481 web_app::GetExtensionIdFromApplicationName(app_name))) { |
480 type = TYPE_POPUP; | 482 type = TYPE_POPUP; |
481 } | 483 } |
482 #if defined(TOOLKIT_GTK) | 484 #if defined(TOOLKIT_GTK) |
483 // Panels are only supported on a white list of window managers for Linux. | 485 // Panels are only supported on a white list of window managers for Linux. |
484 if (type == TYPE_PANEL) { | 486 if (type == TYPE_PANEL) { |
485 ui::WindowManagerName wm_type = ui::GuessWindowManager(); | 487 ui::WindowManagerName wm_type = ui::GuessWindowManager(); |
486 if (wm_type != ui::WM_COMPIZ && | 488 if (wm_type != ui::WM_COMPIZ && |
487 wm_type != ui::WM_ICE_WM && | 489 wm_type != ui::WM_ICE_WM && |
488 wm_type != ui::WM_KWIN && | 490 wm_type != ui::WM_KWIN && |
489 wm_type != ui::WM_METACITY && | 491 wm_type != ui::WM_METACITY && |
490 wm_type != ui::WM_MUTTER) { | 492 wm_type != ui::WM_MUTTER) { |
491 type = TYPE_POPUP; | 493 type = TYPE_POPUP; |
492 } | 494 } |
493 } | 495 } |
494 #endif // TOOLKIT_GTK | 496 #endif // TOOLKIT_GTK |
| 497 #endif // !OS_CHROMEOS || USE_AURA |
495 | 498 |
496 CreateParams params(type, profile); | 499 CreateParams params(type, profile); |
497 params.app_name = app_name; | 500 params.app_name = app_name; |
498 params.initial_bounds = window_bounds; | 501 params.initial_bounds = window_bounds; |
499 return CreateWithParams(params); | 502 return CreateWithParams(params); |
500 } | 503 } |
501 | 504 |
502 // static | 505 // static |
503 Browser* Browser::CreateForDevTools(Profile* profile) { | 506 Browser* Browser::CreateForDevTools(Profile* profile) { |
504 #if defined(OS_CHROMEOS) | 507 #if defined(OS_CHROMEOS) |
(...skipping 3775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4280 gfx::Rect Browser::GetInstantBounds() { | 4283 gfx::Rect Browser::GetInstantBounds() { |
4281 return window()->GetInstantBounds(); | 4284 return window()->GetInstantBounds(); |
4282 } | 4285 } |
4283 | 4286 |
4284 /////////////////////////////////////////////////////////////////////////////// | 4287 /////////////////////////////////////////////////////////////////////////////// |
4285 // Browser, protected: | 4288 // Browser, protected: |
4286 | 4289 |
4287 BrowserWindow* Browser::CreateBrowserWindow() { | 4290 BrowserWindow* Browser::CreateBrowserWindow() { |
4288 #if !defined(OS_CHROMEOS) || defined(USE_AURA) | 4291 #if !defined(OS_CHROMEOS) || defined(USE_AURA) |
4289 if (type_ == TYPE_PANEL) { | 4292 if (type_ == TYPE_PANEL) { |
4290 DCHECK(!CommandLine::ForCurrentProcess()->HasSwitch( | |
4291 switches::kDisablePanels)); | |
4292 return PanelManager::GetInstance()->CreatePanel(this); | 4293 return PanelManager::GetInstance()->CreatePanel(this); |
4293 } | 4294 } |
4294 #endif | 4295 #endif |
4295 | 4296 |
4296 return BrowserWindow::CreateBrowserWindow(this); | 4297 return BrowserWindow::CreateBrowserWindow(this); |
4297 } | 4298 } |
4298 | 4299 |
4299 | 4300 |
4300 /////////////////////////////////////////////////////////////////////////////// | 4301 /////////////////////////////////////////////////////////////////////////////// |
4301 // Browser, Command and state updating (private): | 4302 // Browser, Command and state updating (private): |
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5333 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type); | 5334 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type); |
5334 } else { | 5335 } else { |
5335 GlobalErrorService* service = | 5336 GlobalErrorService* service = |
5336 GlobalErrorServiceFactory::GetForProfile(profile()); | 5337 GlobalErrorServiceFactory::GetForProfile(profile()); |
5337 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); | 5338 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); |
5338 if (error) { | 5339 if (error) { |
5339 error->ShowBubbleView(this); | 5340 error->ShowBubbleView(this); |
5340 } | 5341 } |
5341 } | 5342 } |
5342 } | 5343 } |
OLD | NEW |