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 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
6 | 6 |
7 #include <Carbon/Carbon.h> | 7 #include <Carbon/Carbon.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 #include <numeric> | 10 #include <numeric> |
11 | 11 |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/mac/mac_util.h" | 13 #include "base/mac/mac_util.h" |
14 #import "base/memory/scoped_nsobject.h" | 14 #import "base/memory/scoped_nsobject.h" |
15 #include "base/sys_string_conversions.h" | 15 #include "base/sys_string_conversions.h" |
16 #include "chrome/app/chrome_command_ids.h" // IDC_* | 16 #include "chrome/app/chrome_command_ids.h" // IDC_* |
17 #include "chrome/browser/bookmarks/bookmark_editor.h" | 17 #include "chrome/browser/bookmarks/bookmark_editor.h" |
| 18 #include "chrome/browser/browser_process.h" |
18 #include "chrome/browser/google/google_util.h" | 19 #include "chrome/browser/google/google_util.h" |
19 #include "chrome/browser/instant/instant_controller.h" | 20 #include "chrome/browser/instant/instant_controller.h" |
20 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/profiles/profile_info_cache.h" |
21 #include "chrome/browser/profiles/profile_manager.h" | 23 #include "chrome/browser/profiles/profile_manager.h" |
22 #include "chrome/browser/sync/profile_sync_service.h" | 24 #include "chrome/browser/sync/profile_sync_service.h" |
23 #include "chrome/browser/sync/sync_ui_util_mac.h" | 25 #include "chrome/browser/sync/sync_ui_util_mac.h" |
24 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" | 26 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" |
25 #include "chrome/browser/tabs/tab_strip_model.h" | 27 #include "chrome/browser/tabs/tab_strip_model.h" |
26 #include "chrome/browser/themes/theme_service.h" | 28 #include "chrome/browser/themes/theme_service.h" |
27 #include "chrome/browser/themes/theme_service_factory.h" | 29 #include "chrome/browser/themes/theme_service_factory.h" |
28 #include "chrome/browser/ui/browser.h" | 30 #include "chrome/browser/ui/browser.h" |
29 #include "chrome/browser/ui/browser_list.h" | 31 #include "chrome/browser/ui/browser_list.h" |
30 #import "chrome/browser/ui/cocoa/background_gradient_view.h" | 32 #import "chrome/browser/ui/cocoa/background_gradient_view.h" |
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1346 | 1348 |
1347 - (BOOL)isTabFullyVisible:(TabView*)tab { | 1349 - (BOOL)isTabFullyVisible:(TabView*)tab { |
1348 return [tabStripController_ isTabFullyVisible:tab]; | 1350 return [tabStripController_ isTabFullyVisible:tab]; |
1349 } | 1351 } |
1350 | 1352 |
1351 - (void)showNewTabButton:(BOOL)show { | 1353 - (void)showNewTabButton:(BOOL)show { |
1352 [tabStripController_ showNewTabButton:show]; | 1354 [tabStripController_ showNewTabButton:show]; |
1353 } | 1355 } |
1354 | 1356 |
1355 - (BOOL)shouldShowAvatar { | 1357 - (BOOL)shouldShowAvatar { |
1356 return [self hasTabStrip] && (browser_->profile()->IsOffTheRecord() || | 1358 if (![self hasTabStrip]) |
1357 ProfileManager::IsMultipleProfilesEnabled()); | 1359 return NO; |
| 1360 |
| 1361 if (browser_->profile()->IsOffTheRecord()) |
| 1362 return YES; |
| 1363 |
| 1364 if (ProfileManager::IsMultipleProfilesEnabled()) { |
| 1365 // Show the profile avatar after the user has created more than one profile. |
| 1366 ProfileInfoCache& cache = |
| 1367 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 1368 return cache.GetNumberOfProfiles() > 1; |
| 1369 } |
| 1370 |
| 1371 return NO; |
1358 } | 1372 } |
1359 | 1373 |
1360 - (BOOL)isBookmarkBarVisible { | 1374 - (BOOL)isBookmarkBarVisible { |
1361 return [bookmarkBarController_ isVisible]; | 1375 return [bookmarkBarController_ isVisible]; |
1362 } | 1376 } |
1363 | 1377 |
1364 - (BOOL)isBookmarkBarAnimating { | 1378 - (BOOL)isBookmarkBarAnimating { |
1365 return [bookmarkBarController_ isAnimationRunning]; | 1379 return [bookmarkBarController_ isAnimationRunning]; |
1366 } | 1380 } |
1367 | 1381 |
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2305 | 2319 |
2306 - (BOOL)supportsBookmarkBar { | 2320 - (BOOL)supportsBookmarkBar { |
2307 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2321 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2308 } | 2322 } |
2309 | 2323 |
2310 - (BOOL)isTabbedWindow { | 2324 - (BOOL)isTabbedWindow { |
2311 return browser_->is_type_tabbed(); | 2325 return browser_->is_type_tabbed(); |
2312 } | 2326 } |
2313 | 2327 |
2314 @end // @implementation BrowserWindowController(WindowType) | 2328 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |