Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Side by Side Diff: chrome/browser/browser.cc

Issue 1141005: Revert r42156, r42157, r42160. Allow dynamic switching in and out of sidetabs... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/browser.h ('k') | chrome/browser/browser_window.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "app/animation.h" 10 #include "app/animation.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 183
184 // Need to know when to alert the user of theme install delay. 184 // Need to know when to alert the user of theme install delay.
185 registrar_.Add(this, NotificationType::EXTENSION_READY_FOR_INSTALL, 185 registrar_.Add(this, NotificationType::EXTENSION_READY_FOR_INSTALL,
186 NotificationService::AllSources()); 186 NotificationService::AllSources());
187 187
188 InitCommandState(); 188 InitCommandState();
189 BrowserList::AddBrowser(this); 189 BrowserList::AddBrowser(this);
190 190
191 encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector, 191 encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector,
192 profile_->GetPrefs(), NULL); 192 profile_->GetPrefs(), NULL);
193 use_vertical_tabs_.Init(prefs::kUseVerticalTabs, profile_->GetPrefs(), this);
194 } 193 }
195 194
196 Browser::~Browser() { 195 Browser::~Browser() {
197 // The tab strip should not have any significant tabs at this point. 196 // The tab strip should not have any significant tabs at this point.
198 DCHECK(!tabstrip_model_.HasNonPhantomTabs()); 197 DCHECK(!tabstrip_model_.HasNonPhantomTabs());
199 tabstrip_model_.RemoveObserver(this); 198 tabstrip_model_.RemoveObserver(this);
200 199
201 BrowserList::RemoveBrowser(this); 200 BrowserList::RemoveBrowser(this);
202 201
203 #if defined(OS_WIN) || defined(OS_LINUX) 202 #if defined(OS_WIN) || defined(OS_LINUX)
(...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1560 prefs->RegisterBooleanPref(prefs::kDeleteFormData, true); 1559 prefs->RegisterBooleanPref(prefs::kDeleteFormData, true);
1561 prefs->RegisterIntegerPref(prefs::kDeleteTimePeriod, 0); 1560 prefs->RegisterIntegerPref(prefs::kDeleteTimePeriod, 0);
1562 prefs->RegisterBooleanPref(prefs::kCheckDefaultBrowser, true); 1561 prefs->RegisterBooleanPref(prefs::kCheckDefaultBrowser, true);
1563 prefs->RegisterBooleanPref(prefs::kShowOmniboxSearchHint, true); 1562 prefs->RegisterBooleanPref(prefs::kShowOmniboxSearchHint, true);
1564 prefs->RegisterIntegerPref(prefs::kNTPPromoLineRemaining, 5); 1563 prefs->RegisterIntegerPref(prefs::kNTPPromoLineRemaining, 5);
1565 prefs->RegisterIntegerPref(prefs::kNTPPromoImageRemaining, 5); 1564 prefs->RegisterIntegerPref(prefs::kNTPPromoImageRemaining, 5);
1566 prefs->RegisterBooleanPref(prefs::kShowExtensionShelf, true); 1565 prefs->RegisterBooleanPref(prefs::kShowExtensionShelf, true);
1567 prefs->RegisterBooleanPref(prefs::kWebAppCreateOnDesktop, true); 1566 prefs->RegisterBooleanPref(prefs::kWebAppCreateOnDesktop, true);
1568 prefs->RegisterBooleanPref(prefs::kWebAppCreateInAppsMenu, true); 1567 prefs->RegisterBooleanPref(prefs::kWebAppCreateInAppsMenu, true);
1569 prefs->RegisterBooleanPref(prefs::kWebAppCreateInQuickLaunchBar, true); 1568 prefs->RegisterBooleanPref(prefs::kWebAppCreateInQuickLaunchBar, true);
1570 prefs->RegisterBooleanPref(prefs::kUseVerticalTabs, false); 1569 prefs->RegisterBooleanPref(prefs::kUseVerticalTabs, true);
1571 prefs->RegisterBooleanPref(prefs::kEnableTranslate, true); 1570 prefs->RegisterBooleanPref(prefs::kEnableTranslate, true);
1572 } 1571 }
1573 1572
1574 // static 1573 // static
1575 Browser* Browser::GetBrowserForController( 1574 Browser* Browser::GetBrowserForController(
1576 const NavigationController* controller, int* index_result) { 1575 const NavigationController* controller, int* index_result) {
1577 BrowserList::const_iterator it; 1576 BrowserList::const_iterator it;
1578 for (it = BrowserList::begin(); it != BrowserList::end(); ++it) { 1577 for (it = BrowserList::begin(); it != BrowserList::end(); ++it) {
1579 int index = (*it)->tabstrip_model_.GetIndexOfController(controller); 1578 int index = (*it)->tabstrip_model_.GetIndexOfController(controller);
1580 if (index != TabStripModel::kNoTab) { 1579 if (index != TabStripModel::kNoTab) {
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1988 BookmarkEditor::EditDetails details; 1987 BookmarkEditor::EditDetails details;
1989 details.type = BookmarkEditor::EditDetails::NEW_FOLDER; 1988 details.type = BookmarkEditor::EditDetails::NEW_FOLDER;
1990 bookmark_utils::GetURLsForOpenTabs(this, &(details.urls)); 1989 bookmark_utils::GetURLsForOpenTabs(this, &(details.urls));
1991 DCHECK(!details.urls.empty()); 1990 DCHECK(!details.urls.empty());
1992 1991
1993 BookmarkEditor::Show(window()->GetNativeHandle(), profile_, 1992 BookmarkEditor::Show(window()->GetNativeHandle(), profile_,
1994 model->GetParentForNewNodes(), details, 1993 model->GetParentForNewNodes(), details,
1995 BookmarkEditor::SHOW_TREE, NULL); 1994 BookmarkEditor::SHOW_TREE, NULL);
1996 } 1995 }
1997 1996
1998 bool Browser::UseVerticalTabs() const {
1999 return use_vertical_tabs_.GetValue();
2000 }
2001
2002 void Browser::ToggleUseVerticalTabs() {
2003 use_vertical_tabs_.SetValue(!UseVerticalTabs());
2004 window()->ToggleTabStripMode();
2005 }
2006
2007 /////////////////////////////////////////////////////////////////////////////// 1997 ///////////////////////////////////////////////////////////////////////////////
2008 // Browser, TabStripModelObserver implementation: 1998 // Browser, TabStripModelObserver implementation:
2009 1999
2010 void Browser::TabInsertedAt(TabContents* contents, 2000 void Browser::TabInsertedAt(TabContents* contents,
2011 int index, 2001 int index,
2012 bool foreground) { 2002 bool foreground) {
2013 contents->set_delegate(this); 2003 contents->set_delegate(this);
2014 contents->controller().SetWindowID(session_id()); 2004 contents->controller().SetWindowID(session_id());
2015 2005
2016 SyncHistoryWithTabs(index); 2006 SyncHistoryWithTabs(index);
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after
3443 if (TabHasUnloadListener(contents)) { 3433 if (TabHasUnloadListener(contents)) {
3444 // If the page has unload listeners, then we tell the renderer to fire 3434 // If the page has unload listeners, then we tell the renderer to fire
3445 // them. Once they have fired, we'll get a message back saying whether 3435 // them. Once they have fired, we'll get a message back saying whether
3446 // to proceed closing the page or not, which sends us back to this method 3436 // to proceed closing the page or not, which sends us back to this method
3447 // with the HasUnloadListener bit cleared. 3437 // with the HasUnloadListener bit cleared.
3448 contents->render_view_host()->FirePageBeforeUnload(false); 3438 contents->render_view_host()->FirePageBeforeUnload(false);
3449 return true; 3439 return true;
3450 } 3440 }
3451 return false; 3441 return false;
3452 } 3442 }
OLDNEW
« no previous file with comments | « chrome/browser/browser.h ('k') | chrome/browser/browser_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698