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/views/frame/browser_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
6 | 6 |
7 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(TOOLKIT_USES_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 } | 452 } |
453 | 453 |
454 bool BrowserView::IsTabStripVisible() const { | 454 bool BrowserView::IsTabStripVisible() const { |
455 return browser_->SupportsWindowFeature(Browser::FEATURE_TABSTRIP); | 455 return browser_->SupportsWindowFeature(Browser::FEATURE_TABSTRIP); |
456 } | 456 } |
457 | 457 |
458 bool BrowserView::IsOffTheRecord() const { | 458 bool BrowserView::IsOffTheRecord() const { |
459 return browser_->profile()->IsOffTheRecord(); | 459 return browser_->profile()->IsOffTheRecord(); |
460 } | 460 } |
461 | 461 |
| 462 bool BrowserView::IsGuestSession() const { |
| 463 return browser_->profile()->IsGuestSession(); |
| 464 } |
| 465 |
462 bool BrowserView::ShouldShowAvatar() const { | 466 bool BrowserView::ShouldShowAvatar() const { |
463 if (!IsBrowserTypeNormal()) | 467 if (!IsBrowserTypeNormal()) |
464 return false; | 468 return false; |
465 if (IsOffTheRecord()) | 469 if (IsOffTheRecord()) |
466 return true; | 470 return true; |
467 | 471 |
468 ProfileInfoCache& cache = | 472 ProfileInfoCache& cache = |
469 g_browser_process->profile_manager()->GetProfileInfoCache(); | 473 g_browser_process->profile_manager()->GetProfileInfoCache(); |
470 if (cache.GetIndexOfProfileWithPath(browser_->profile()->GetPath()) == | 474 if (cache.GetIndexOfProfileWithPath(browser_->profile()->GetPath()) == |
471 std::string::npos) { | 475 std::string::npos) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 } | 542 } |
539 | 543 |
540 TabContents* BrowserView::GetSelectedTabContents() const { | 544 TabContents* BrowserView::GetSelectedTabContents() const { |
541 return browser_->GetSelectedTabContents(); | 545 return browser_->GetSelectedTabContents(); |
542 } | 546 } |
543 | 547 |
544 TabContentsWrapper* BrowserView::GetSelectedTabContentsWrapper() const { | 548 TabContentsWrapper* BrowserView::GetSelectedTabContentsWrapper() const { |
545 return browser_->GetSelectedTabContentsWrapper(); | 549 return browser_->GetSelectedTabContentsWrapper(); |
546 } | 550 } |
547 | 551 |
548 SkBitmap BrowserView::GetOTRAvatarIcon() { | 552 SkBitmap BrowserView::GetOTRAvatarIcon() const { |
549 static SkBitmap* otr_avatar_ = new SkBitmap(); | 553 static SkBitmap* otr_avatar_ = new SkBitmap(); |
550 | 554 |
551 if (otr_avatar_->isNull()) { | 555 if (otr_avatar_->isNull()) { |
552 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 556 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
553 *otr_avatar_ = *rb.GetBitmapNamed(IDR_OTR_ICON); | 557 *otr_avatar_ = *rb.GetBitmapNamed(IDR_OTR_ICON); |
554 } | 558 } |
555 return *otr_avatar_; | 559 return *otr_avatar_; |
556 } | 560 } |
557 | 561 |
| 562 SkBitmap BrowserView::GetGuestAvatarIcon() const { |
| 563 #if defined(OS_CHROMEOS) |
| 564 static SkBitmap* guest_avatar_ = new SkBitmap(); |
| 565 |
| 566 if (guest_avatar_->isNull()) { |
| 567 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 568 *guest_avatar_ = *rb.GetBitmapNamed(IDR_GUEST_ICON); |
| 569 } |
| 570 return *guest_avatar_; |
| 571 #else |
| 572 NOTREACHED(); |
| 573 return SkBitmap(); |
| 574 #endif |
| 575 } |
| 576 |
558 #if defined(OS_WIN) && !defined(USE_AURA) | 577 #if defined(OS_WIN) && !defined(USE_AURA) |
559 void BrowserView::PrepareToRunSystemMenu(HMENU menu) { | 578 void BrowserView::PrepareToRunSystemMenu(HMENU menu) { |
560 system_menu_->UpdateStates(); | 579 system_menu_->UpdateStates(); |
561 } | 580 } |
562 #endif | 581 #endif |
563 | 582 |
564 // static | 583 // static |
565 void BrowserView::RegisterBrowserViewPrefs(PrefService* prefs) { | 584 void BrowserView::RegisterBrowserViewPrefs(PrefService* prefs) { |
566 prefs->RegisterIntegerPref(prefs::kPluginMessageResponseTimeout, | 585 prefs->RegisterIntegerPref(prefs::kPluginMessageResponseTimeout, |
567 kDefaultPluginMessageResponseTimeout); | 586 kDefaultPluginMessageResponseTimeout); |
(...skipping 2070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2638 browser::CreateViewsBubble(bubble); | 2657 browser::CreateViewsBubble(bubble); |
2639 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); | 2658 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); |
2640 bubble->Show(); | 2659 bubble->Show(); |
2641 } | 2660 } |
2642 | 2661 |
2643 void BrowserView::ShowAvatarBubbleFromAvatarButton() { | 2662 void BrowserView::ShowAvatarBubbleFromAvatarButton() { |
2644 AvatarMenuButton* button = frame_->GetAvatarMenuButton(); | 2663 AvatarMenuButton* button = frame_->GetAvatarMenuButton(); |
2645 if (button) | 2664 if (button) |
2646 button->ShowAvatarBubble(); | 2665 button->ShowAvatarBubble(); |
2647 } | 2666 } |
OLD | NEW |