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

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: update 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.GetBitmapNamed(IDR_OTR_ICON);
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();
567
568 if (managed_mode_avatar_->isNull()) {
569 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
570 *managed_mode_avatar_ = *rb.GetBitmapNamed(IDR_MANAGED_MODE_AVATAR);
sky 2012/04/25 17:12:26 This is deprecated, don't use it in new code.
Bernhard Bauer 2012/04/25 17:57:30 Done.
571 }
572 return *managed_mode_avatar_;
573 }
574
562 SkBitmap BrowserView::GetGuestAvatarIcon() const { 575 SkBitmap BrowserView::GetGuestAvatarIcon() const {
563 #if defined(OS_CHROMEOS) 576 #if defined(OS_CHROMEOS)
564 static SkBitmap* guest_avatar_ = new SkBitmap(); 577 static SkBitmap* guest_avatar_ = new SkBitmap();
565 578
566 if (guest_avatar_->isNull()) { 579 if (guest_avatar_->isNull()) {
567 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 580 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
568 *guest_avatar_ = *rb.GetBitmapNamed(IDR_GUEST_ICON); 581 *guest_avatar_ = *rb.GetBitmapNamed(IDR_GUEST_ICON);
569 } 582 }
570 return *guest_avatar_; 583 return *guest_avatar_;
571 #else 584 #else
(...skipping 1913 matching lines...) Expand 10 before | Expand all | Expand 10 after
2485 return; 2498 return;
2486 2499
2487 PasswordGenerationBubbleView* bubble = 2500 PasswordGenerationBubbleView* bubble =
2488 new PasswordGenerationBubbleView(bounds, 2501 new PasswordGenerationBubbleView(bounds,
2489 this, 2502 this,
2490 web_contents->GetRenderViewHost()); 2503 web_contents->GetRenderViewHost());
2491 views::BubbleDelegateView::CreateBubble(bubble); 2504 views::BubbleDelegateView::CreateBubble(bubble);
2492 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); 2505 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE);
2493 bubble->Show(); 2506 bubble->Show();
2494 } 2507 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698