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

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

Issue 3056003: Attemp 2 at: (Closed)
Patch Set: Fix chromeos breakage Created 10 years, 5 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
« 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 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <shellapi.h> 8 #include <shellapi.h>
9 #include <windows.h> 9 #include <windows.h>
10 #endif // OS_WIN 10 #endif // OS_WIN
(...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 features |= FEATURE_EXTENSIONSHELF; 1144 features |= FEATURE_EXTENSIONSHELF;
1145 } 1145 }
1146 1146
1147 if (!hide_ui_for_fullscreen) { 1147 if (!hide_ui_for_fullscreen) {
1148 if (type() != TYPE_NORMAL && type() != TYPE_EXTENSION_APP) 1148 if (type() != TYPE_NORMAL && type() != TYPE_EXTENSION_APP)
1149 features |= FEATURE_TITLEBAR; 1149 features |= FEATURE_TITLEBAR;
1150 1150
1151 if (type() == TYPE_NORMAL || type() == TYPE_EXTENSION_APP) 1151 if (type() == TYPE_NORMAL || type() == TYPE_EXTENSION_APP)
1152 features |= FEATURE_TABSTRIP; 1152 features |= FEATURE_TABSTRIP;
1153 1153
1154 // TODO(aa): This is kinda a hack. The toolbar is not really there, it is
1155 // collapsed. We probably want to add a FEATURE_MINI_TOOLBAR to represent
1156 // the collapsed state.
1157 if (type() == TYPE_NORMAL || type() == TYPE_EXTENSION_APP) 1154 if (type() == TYPE_NORMAL || type() == TYPE_EXTENSION_APP)
1158 features |= FEATURE_TOOLBAR; 1155 features |= FEATURE_TOOLBAR;
1159 1156
1160 if (type() != TYPE_EXTENSION_APP && (type() & Browser::TYPE_APP) == 0) 1157 if (type() != TYPE_EXTENSION_APP && (type() & Browser::TYPE_APP) == 0)
1161 features |= FEATURE_LOCATIONBAR; 1158 features |= FEATURE_LOCATIONBAR;
1162 } 1159 }
1163 return !!(features & feature); 1160 return !!(features & feature);
1164 } 1161 }
1165 1162
1166 bool Browser::IsClosingPermitted() { 1163 bool Browser::IsClosingPermitted() {
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after
2360 2357
2361 bool Browser::UseVerticalTabs() const { 2358 bool Browser::UseVerticalTabs() const {
2362 return use_vertical_tabs_.GetValue(); 2359 return use_vertical_tabs_.GetValue();
2363 } 2360 }
2364 2361
2365 void Browser::ToggleUseVerticalTabs() { 2362 void Browser::ToggleUseVerticalTabs() {
2366 use_vertical_tabs_.SetValue(!UseVerticalTabs()); 2363 use_vertical_tabs_.SetValue(!UseVerticalTabs());
2367 UseVerticalTabsChanged(); 2364 UseVerticalTabsChanged();
2368 } 2365 }
2369 2366
2370 void Browser::SetToolbarVisibility(bool visible) {
2371 window()->SetToolbarCollapsedMode(!visible);
2372 }
2373
2374 /////////////////////////////////////////////////////////////////////////////// 2367 ///////////////////////////////////////////////////////////////////////////////
2375 // Browser, TabStripModelObserver implementation: 2368 // Browser, TabStripModelObserver implementation:
2376 2369
2377 void Browser::TabInsertedAt(TabContents* contents, 2370 void Browser::TabInsertedAt(TabContents* contents,
2378 int index, 2371 int index,
2379 bool foreground) { 2372 bool foreground) {
2380 contents->set_delegate(this); 2373 contents->set_delegate(this);
2381 contents->controller().SetWindowID(session_id()); 2374 contents->controller().SetWindowID(session_id());
2382 2375
2383 SyncHistoryWithTabs(index); 2376 SyncHistoryWithTabs(index);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
2447 2440
2448 // Update sessions. Don't force creation of sessions. If sessions doesn't 2441 // Update sessions. Don't force creation of sessions. If sessions doesn't
2449 // exist, the change will be picked up by sessions when created. 2442 // exist, the change will be picked up by sessions when created.
2450 if (profile_->HasSessionService()) { 2443 if (profile_->HasSessionService()) {
2451 SessionService* session_service = profile_->GetSessionService(); 2444 SessionService* session_service = profile_->GetSessionService();
2452 if (session_service && !tabstrip_model_.closing_all()) { 2445 if (session_service && !tabstrip_model_.closing_all()) {
2453 session_service->SetSelectedTabInWindow( 2446 session_service->SetSelectedTabInWindow(
2454 session_id(), tabstrip_model_.selected_index()); 2447 session_id(), tabstrip_model_.selected_index());
2455 } 2448 }
2456 } 2449 }
2457
2458 window()->SetToolbarCollapsedMode(!tabstrip_model_.IsToolbarVisible(index));
2459 } 2450 }
2460 2451
2461 void Browser::TabMoved(TabContents* contents, 2452 void Browser::TabMoved(TabContents* contents,
2462 int from_index, 2453 int from_index,
2463 int to_index) { 2454 int to_index) {
2464 DCHECK(from_index >= 0 && to_index >= 0); 2455 DCHECK(from_index >= 0 && to_index >= 0);
2465 // Notify the history service. 2456 // Notify the history service.
2466 SyncHistoryWithTabs(std::min(from_index, to_index)); 2457 SyncHistoryWithTabs(std::min(from_index, to_index));
2467 } 2458 }
2468 2459
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after
4037 } 4028 }
4038 4029
4039 bool Browser::IsPinned(TabContents* source) { 4030 bool Browser::IsPinned(TabContents* source) {
4040 int index = tabstrip_model_.GetIndexOfTabContents(source); 4031 int index = tabstrip_model_.GetIndexOfTabContents(source);
4041 if (index == TabStripModel::kNoTab) { 4032 if (index == TabStripModel::kNoTab) {
4042 NOTREACHED() << "IsPinned called for tab not in our strip"; 4033 NOTREACHED() << "IsPinned called for tab not in our strip";
4043 return false; 4034 return false;
4044 } 4035 }
4045 return tabstrip_model_.IsTabPinned(index); 4036 return tabstrip_model_.IsTabPinned(index);
4046 } 4037 }
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