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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 // static | 467 // static |
468 Browser* Browser::CreateForApp(Type type, | 468 Browser* Browser::CreateForApp(Type type, |
469 const std::string& app_name, | 469 const std::string& app_name, |
470 const gfx::Rect& window_bounds, | 470 const gfx::Rect& window_bounds, |
471 Profile* profile) { | 471 Profile* profile) { |
472 DCHECK(type != TYPE_TABBED); | 472 DCHECK(type != TYPE_TABBED); |
473 DCHECK(!app_name.empty()); | 473 DCHECK(!app_name.empty()); |
474 | 474 |
475 RegisterAppPrefs(app_name, profile); | 475 RegisterAppPrefs(app_name, profile); |
476 | 476 |
| 477 #if !defined(OS_CHROMEOS) || defined(USE_AURA) |
477 if (type == TYPE_PANEL && | 478 if (type == TYPE_PANEL && |
478 CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisablePanels)) { | 479 !PanelManager::ShouldUsePanels( |
| 480 web_app::GetExtensionIdFromApplicationName(app_name))) { |
479 type = TYPE_POPUP; | 481 type = TYPE_POPUP; |
480 } | 482 } |
481 #if defined(TOOLKIT_GTK) | 483 #if defined(TOOLKIT_GTK) |
482 // Panels are only supported on a white list of window managers for Linux. | 484 // Panels are only supported on a white list of window managers for Linux. |
483 if (type == TYPE_PANEL) { | 485 if (type == TYPE_PANEL) { |
484 ui::WindowManagerName wm_type = ui::GuessWindowManager(); | 486 ui::WindowManagerName wm_type = ui::GuessWindowManager(); |
485 if (wm_type != ui::WM_COMPIZ && | 487 if (wm_type != ui::WM_COMPIZ && |
486 wm_type != ui::WM_ICE_WM && | 488 wm_type != ui::WM_ICE_WM && |
487 wm_type != ui::WM_KWIN && | 489 wm_type != ui::WM_KWIN && |
488 wm_type != ui::WM_METACITY && | 490 wm_type != ui::WM_METACITY && |
489 wm_type != ui::WM_MUTTER) { | 491 wm_type != ui::WM_MUTTER) { |
490 type = TYPE_POPUP; | 492 type = TYPE_POPUP; |
491 } | 493 } |
492 } | 494 } |
493 #endif // TOOLKIT_GTK | 495 #endif // TOOLKIT_GTK |
| 496 #endif // !OS_CHROMEOS || USE_AURA |
494 | 497 |
495 CreateParams params(type, profile); | 498 CreateParams params(type, profile); |
496 params.app_name = app_name; | 499 params.app_name = app_name; |
497 params.initial_bounds = window_bounds; | 500 params.initial_bounds = window_bounds; |
498 return CreateWithParams(params); | 501 return CreateWithParams(params); |
499 } | 502 } |
500 | 503 |
501 // static | 504 // static |
502 Browser* Browser::CreateForDevTools(Profile* profile) { | 505 Browser* Browser::CreateForDevTools(Profile* profile) { |
503 #if defined(OS_CHROMEOS) | 506 #if defined(OS_CHROMEOS) |
(...skipping 3777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4281 gfx::Rect Browser::GetInstantBounds() { | 4284 gfx::Rect Browser::GetInstantBounds() { |
4282 return window()->GetInstantBounds(); | 4285 return window()->GetInstantBounds(); |
4283 } | 4286 } |
4284 | 4287 |
4285 /////////////////////////////////////////////////////////////////////////////// | 4288 /////////////////////////////////////////////////////////////////////////////// |
4286 // Browser, protected: | 4289 // Browser, protected: |
4287 | 4290 |
4288 BrowserWindow* Browser::CreateBrowserWindow() { | 4291 BrowserWindow* Browser::CreateBrowserWindow() { |
4289 #if !defined(OS_CHROMEOS) || defined(USE_AURA) | 4292 #if !defined(OS_CHROMEOS) || defined(USE_AURA) |
4290 if (type_ == TYPE_PANEL) { | 4293 if (type_ == TYPE_PANEL) { |
4291 DCHECK(!CommandLine::ForCurrentProcess()->HasSwitch( | |
4292 switches::kDisablePanels)); | |
4293 return PanelManager::GetInstance()->CreatePanel(this); | 4294 return PanelManager::GetInstance()->CreatePanel(this); |
4294 } | 4295 } |
4295 #endif | 4296 #endif |
4296 | 4297 |
4297 return BrowserWindow::CreateBrowserWindow(this); | 4298 return BrowserWindow::CreateBrowserWindow(this); |
4298 } | 4299 } |
4299 | 4300 |
4300 | 4301 |
4301 /////////////////////////////////////////////////////////////////////////////// | 4302 /////////////////////////////////////////////////////////////////////////////// |
4302 // Browser, Command and state updating (private): | 4303 // Browser, Command and state updating (private): |
(...skipping 1030 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 |