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/idle_timer.h" | 10 #include "base/idle_timer.h" |
(...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 browser->set_maximized_state( | 1404 browser->set_maximized_state( |
1405 maximize ? MAXIMIZED_STATE_MAXIMIZED : MAXIMIZED_STATE_UNMAXIMIZED); | 1405 maximize ? MAXIMIZED_STATE_MAXIMIZED : MAXIMIZED_STATE_UNMAXIMIZED); |
1406 browser->CreateBrowserWindow(); | 1406 browser->CreateBrowserWindow(); |
1407 browser->tabstrip_model()->AppendTabContents(detached_contents, true); | 1407 browser->tabstrip_model()->AppendTabContents(detached_contents, true); |
1408 // Make sure the loading state is updated correctly, otherwise the throbber | 1408 // Make sure the loading state is updated correctly, otherwise the throbber |
1409 // won't start if the page is loading. | 1409 // won't start if the page is loading. |
1410 browser->LoadingStateChanged(detached_contents); | 1410 browser->LoadingStateChanged(detached_contents); |
1411 return browser; | 1411 return browser; |
1412 } | 1412 } |
1413 | 1413 |
| 1414 void Browser::ContinueDraggingDetachedTab(TabContents* contents, |
| 1415 const gfx::Rect& window_bounds, |
| 1416 const gfx::Rect& tab_bounds) { |
| 1417 Browser* browser = new Browser(TYPE_NORMAL, profile_); |
| 1418 browser->set_override_bounds(window_bounds); |
| 1419 browser->CreateBrowserWindow(); |
| 1420 browser->tabstrip_model()->AppendTabContents(contents, true); |
| 1421 browser->LoadingStateChanged(contents); |
| 1422 browser->window()->Show(); |
| 1423 browser->window()->ContinueDraggingDetachedTab(tab_bounds); |
| 1424 } |
| 1425 |
1414 int Browser::GetDragActions() const { | 1426 int Browser::GetDragActions() const { |
1415 return TAB_TEAROFF_ACTION | (tab_count() > 1 ? TAB_MOVE_ACTION : 0); | 1427 return TAB_TEAROFF_ACTION | (tab_count() > 1 ? TAB_MOVE_ACTION : 0); |
1416 } | 1428 } |
1417 | 1429 |
1418 TabContents* Browser::CreateTabContentsForURL( | 1430 TabContents* Browser::CreateTabContentsForURL( |
1419 const GURL& url, const GURL& referrer, Profile* profile, | 1431 const GURL& url, const GURL& referrer, Profile* profile, |
1420 PageTransition::Type transition, bool defer_load, | 1432 PageTransition::Type transition, bool defer_load, |
1421 SiteInstance* instance) const { | 1433 SiteInstance* instance) const { |
1422 TabContents* contents = new TabContents(profile, instance, | 1434 TabContents* contents = new TabContents(profile, instance, |
1423 MSG_ROUTING_NONE, NULL); | 1435 MSG_ROUTING_NONE, NULL); |
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2705 /////////////////////////////////////////////////////////////////////////////// | 2717 /////////////////////////////////////////////////////////////////////////////// |
2706 // BrowserToolbarModel (private): | 2718 // BrowserToolbarModel (private): |
2707 | 2719 |
2708 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { | 2720 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { |
2709 // This |current_tab| can be NULL during the initialization of the | 2721 // This |current_tab| can be NULL during the initialization of the |
2710 // toolbar during window creation (i.e. before any tabs have been added | 2722 // toolbar during window creation (i.e. before any tabs have been added |
2711 // to the window). | 2723 // to the window). |
2712 TabContents* current_tab = browser_->GetSelectedTabContents(); | 2724 TabContents* current_tab = browser_->GetSelectedTabContents(); |
2713 return current_tab ? ¤t_tab->controller() : NULL; | 2725 return current_tab ? ¤t_tab->controller() : NULL; |
2714 } | 2726 } |
OLD | NEW |