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

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 9500003: Add a button to exit managed mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 8 years, 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/i18n/rtl.h" 11 #include "base/i18n/rtl.h"
12 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
13 #include "base/string_number_conversions.h" 13 #include "base/string_number_conversions.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "chrome/app/chrome_command_ids.h" 15 #include "chrome/app/chrome_command_ids.h"
16 #include "chrome/app/chrome_dll_resource.h" 16 #include "chrome/app/chrome_dll_resource.h"
17 #include "chrome/browser/accessibility/invert_bubble_views.h" 17 #include "chrome/browser/accessibility/invert_bubble_views.h"
18 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" 18 #include "chrome/browser/autocomplete/autocomplete_popup_model.h"
19 #include "chrome/browser/autocomplete/autocomplete_popup_view.h" 19 #include "chrome/browser/autocomplete/autocomplete_popup_view.h"
20 #include "chrome/browser/bookmarks/bookmark_utils.h" 20 #include "chrome/browser/bookmarks/bookmark_utils.h"
21 #include "chrome/browser/browser_process.h" 21 #include "chrome/browser/browser_process.h"
22 #include "chrome/browser/debugger/devtools_window.h" 22 #include "chrome/browser/debugger/devtools_window.h"
23 #include "chrome/browser/extensions/extension_tab_helper.h" 23 #include "chrome/browser/extensions/extension_tab_helper.h"
24 #include "chrome/browser/instant/instant_controller.h" 24 #include "chrome/browser/instant/instant_controller.h"
25 #include "chrome/browser/native_window_notification_source.h" 25 #include "chrome/browser/native_window_notification_source.h"
26 #include "chrome/browser/ntp_background_util.h" 26 #include "chrome/browser/ntp_background_util.h"
27 #include "chrome/browser/managed_mode.h"
27 #include "chrome/browser/prefs/pref_service.h" 28 #include "chrome/browser/prefs/pref_service.h"
28 #include "chrome/browser/profiles/avatar_menu_model.h" 29 #include "chrome/browser/profiles/avatar_menu_model.h"
29 #include "chrome/browser/profiles/profile.h" 30 #include "chrome/browser/profiles/profile.h"
30 #include "chrome/browser/profiles/profile_info_cache.h" 31 #include "chrome/browser/profiles/profile_info_cache.h"
31 #include "chrome/browser/profiles/profile_manager.h" 32 #include "chrome/browser/profiles/profile_manager.h"
32 #include "chrome/browser/sessions/tab_restore_service.h" 33 #include "chrome/browser/sessions/tab_restore_service.h"
33 #include "chrome/browser/sessions/tab_restore_service_factory.h" 34 #include "chrome/browser/sessions/tab_restore_service_factory.h"
34 #include "chrome/browser/speech/extension_api/tts_extension_api.h" 35 #include "chrome/browser/speech/extension_api/tts_extension_api.h"
35 #include "chrome/browser/tabs/tab_strip_model.h" 36 #include "chrome/browser/tabs/tab_strip_model.h"
36 #include "chrome/browser/themes/theme_service.h" 37 #include "chrome/browser/themes/theme_service.h"
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 462
462 bool BrowserView::IsGuestSession() const { 463 bool BrowserView::IsGuestSession() const {
463 return browser_->profile()->IsGuestSession(); 464 return browser_->profile()->IsGuestSession();
464 } 465 }
465 466
466 bool BrowserView::ShouldShowAvatar() const { 467 bool BrowserView::ShouldShowAvatar() const {
467 if (!IsBrowserTypeNormal()) 468 if (!IsBrowserTypeNormal())
468 return false; 469 return false;
469 if (IsOffTheRecord()) 470 if (IsOffTheRecord())
470 return true; 471 return true;
472 if (ManagedMode::IsInManagedMode())
473 return true;
471 474
472 ProfileInfoCache& cache = 475 ProfileInfoCache& cache =
473 g_browser_process->profile_manager()->GetProfileInfoCache(); 476 g_browser_process->profile_manager()->GetProfileInfoCache();
474 if (cache.GetIndexOfProfileWithPath(browser_->profile()->GetPath()) == 477 if (cache.GetIndexOfProfileWithPath(browser_->profile()->GetPath()) ==
475 std::string::npos) { 478 std::string::npos) {
476 return false; 479 return false;
477 } 480 }
478 481
479 return AvatarMenuModel::ShouldShowAvatarMenu(); 482 return AvatarMenuModel::ShouldShowAvatarMenu();
480 } 483 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 550
548 TabContentsWrapper* BrowserView::GetSelectedTabContentsWrapper() const { 551 TabContentsWrapper* BrowserView::GetSelectedTabContentsWrapper() const {
549 return browser_->GetSelectedTabContentsWrapper(); 552 return browser_->GetSelectedTabContentsWrapper();
550 } 553 }
551 554
552 SkBitmap BrowserView::GetOTRAvatarIcon() const { 555 SkBitmap BrowserView::GetOTRAvatarIcon() const {
553 static SkBitmap* otr_avatar_ = new SkBitmap(); 556 static SkBitmap* otr_avatar_ = new SkBitmap();
554 557
555 if (otr_avatar_->isNull()) { 558 if (otr_avatar_->isNull()) {
556 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 559 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
557 *otr_avatar_ = *rb.GetBitmapNamed(IDR_OTR_ICON); 560 *otr_avatar_ = *rb.GetImageNamed(IDR_OTR_ICON).ToSkBitmap();
558 } 561 }
559 return *otr_avatar_; 562 return *otr_avatar_;
560 } 563 }
561 564
565 SkBitmap BrowserView::GetManagedModeAvatarIcon() const {
566 static SkBitmap* managed_mode_avatar_ = new SkBitmap();
sail 2012/04/25 18:02:46 you don't need this static, the resource bundle wi
Bernhard Bauer 2012/04/26 16:46:15 Done.
567
568 if (managed_mode_avatar_->isNull()) {
569 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
570 *managed_mode_avatar_ = *rb.GetImageNamed(
571 IDR_MANAGED_MODE_AVATAR).ToSkBitmap();
572 }
573 return *managed_mode_avatar_;
574 }
575
562 SkBitmap BrowserView::GetGuestAvatarIcon() const { 576 SkBitmap BrowserView::GetGuestAvatarIcon() const {
563 #if defined(OS_CHROMEOS) 577 #if defined(OS_CHROMEOS)
564 static SkBitmap* guest_avatar_ = new SkBitmap(); 578 static SkBitmap* guest_avatar_ = new SkBitmap();
565 579
566 if (guest_avatar_->isNull()) { 580 if (guest_avatar_->isNull()) {
567 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 581 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
568 *guest_avatar_ = *rb.GetBitmapNamed(IDR_GUEST_ICON); 582 *guest_avatar_ = *rb.GetImageNamed(IDR_GUEST_ICON).ToSkBitmap();
569 } 583 }
570 return *guest_avatar_; 584 return *guest_avatar_;
571 #else 585 #else
572 NOTREACHED(); 586 NOTREACHED();
573 return SkBitmap(); 587 return SkBitmap();
574 #endif 588 #endif
575 } 589 }
576 590
577 // static 591 // static
578 void BrowserView::RegisterBrowserViewPrefs(PrefService* prefs) { 592 void BrowserView::RegisterBrowserViewPrefs(PrefService* prefs) {
(...skipping 1906 matching lines...) Expand 10 before | Expand all | Expand 10 after
2485 return; 2499 return;
2486 2500
2487 PasswordGenerationBubbleView* bubble = 2501 PasswordGenerationBubbleView* bubble =
2488 new PasswordGenerationBubbleView(bounds, 2502 new PasswordGenerationBubbleView(bounds,
2489 this, 2503 this,
2490 web_contents->GetRenderViewHost()); 2504 web_contents->GetRenderViewHost());
2491 views::BubbleDelegateView::CreateBubble(bubble); 2505 views::BubbleDelegateView::CreateBubble(bubble);
2492 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); 2506 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE);
2493 bubble->Show(); 2507 bubble->Show();
2494 } 2508 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698