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