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

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: fix Created 8 years, 7 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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 461
461 bool BrowserView::IsGuestSession() const { 462 bool BrowserView::IsGuestSession() const {
462 return browser_->profile()->IsGuestSession(); 463 return browser_->profile()->IsGuestSession();
463 } 464 }
464 465
465 bool BrowserView::ShouldShowAvatar() const { 466 bool BrowserView::ShouldShowAvatar() const {
466 if (!IsBrowserTypeNormal()) 467 if (!IsBrowserTypeNormal())
467 return false; 468 return false;
468 if (IsOffTheRecord()) 469 if (IsOffTheRecord())
469 return true; 470 return true;
471 if (ManagedMode::IsInManagedMode())
472 return true;
470 473
471 ProfileInfoCache& cache = 474 ProfileInfoCache& cache =
472 g_browser_process->profile_manager()->GetProfileInfoCache(); 475 g_browser_process->profile_manager()->GetProfileInfoCache();
473 if (cache.GetIndexOfProfileWithPath(browser_->profile()->GetPath()) == 476 if (cache.GetIndexOfProfileWithPath(browser_->profile()->GetPath()) ==
474 std::string::npos) { 477 std::string::npos) {
475 return false; 478 return false;
476 } 479 }
477 480
478 return AvatarMenuModel::ShouldShowAvatarMenu(); 481 return AvatarMenuModel::ShouldShowAvatarMenu();
479 } 482 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 545
543 WebContents* BrowserView::GetSelectedWebContents() const { 546 WebContents* BrowserView::GetSelectedWebContents() const {
544 return browser_->GetSelectedWebContents(); 547 return browser_->GetSelectedWebContents();
545 } 548 }
546 549
547 TabContentsWrapper* BrowserView::GetSelectedTabContentsWrapper() const { 550 TabContentsWrapper* BrowserView::GetSelectedTabContentsWrapper() const {
548 return browser_->GetSelectedTabContentsWrapper(); 551 return browser_->GetSelectedTabContentsWrapper();
549 } 552 }
550 553
551 SkBitmap BrowserView::GetOTRAvatarIcon() const { 554 SkBitmap BrowserView::GetOTRAvatarIcon() const {
552 static SkBitmap* otr_avatar_ = new SkBitmap(); 555 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
553 556 const SkBitmap* otr_avatar =
554 if (otr_avatar_->isNull()) { 557 rb.GetNativeImageNamed(IDR_OTR_ICON).ToSkBitmap();
555 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 558 return *otr_avatar;
556 *otr_avatar_ = *rb.GetBitmapNamed(IDR_OTR_ICON);
557 }
558 return *otr_avatar_;
559 }
560
561 SkBitmap BrowserView::GetGuestAvatarIcon() const {
562 #if defined(OS_CHROMEOS)
563 static SkBitmap* guest_avatar_ = new SkBitmap();
564
565 if (guest_avatar_->isNull()) {
566 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
567 *guest_avatar_ = *rb.GetBitmapNamed(IDR_GUEST_ICON);
568 }
569 return *guest_avatar_;
570 #else
571 NOTREACHED();
572 return SkBitmap();
573 #endif
574 } 559 }
575 560
576 // static 561 // static
577 void BrowserView::RegisterBrowserViewPrefs(PrefService* prefs) { 562 void BrowserView::RegisterBrowserViewPrefs(PrefService* prefs) {
578 prefs->RegisterIntegerPref(prefs::kPluginMessageResponseTimeout, 563 prefs->RegisterIntegerPref(prefs::kPluginMessageResponseTimeout,
579 kDefaultPluginMessageResponseTimeout); 564 kDefaultPluginMessageResponseTimeout);
580 prefs->RegisterIntegerPref(prefs::kHungPluginDetectFrequency, 565 prefs->RegisterIntegerPref(prefs::kHungPluginDetectFrequency,
581 kDefaultHungPluginDetectFrequency); 566 kDefaultHungPluginDetectFrequency);
582 } 567 }
583 568
(...skipping 1900 matching lines...) Expand 10 before | Expand all | Expand 10 after
2484 return; 2469 return;
2485 2470
2486 PasswordGenerationBubbleView* bubble = 2471 PasswordGenerationBubbleView* bubble =
2487 new PasswordGenerationBubbleView(bounds, 2472 new PasswordGenerationBubbleView(bounds,
2488 this, 2473 this,
2489 web_contents->GetRenderViewHost()); 2474 web_contents->GetRenderViewHost());
2490 views::BubbleDelegateView::CreateBubble(bubble); 2475 views::BubbleDelegateView::CreateBubble(bubble);
2491 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); 2476 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE);
2492 bubble->Show(); 2477 bubble->Show();
2493 } 2478 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698