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

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

Issue 1701563002: Refactor ProfileInfoCache in c/b/ui/views (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to comments Created 4 years, 10 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 <stdint.h> 7 #include <stdint.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 14 matching lines...) Expand all
25 #include "chrome/browser/app_mode/app_mode_utils.h" 25 #include "chrome/browser/app_mode/app_mode_utils.h"
26 #include "chrome/browser/bookmarks/bookmark_stats.h" 26 #include "chrome/browser/bookmarks/bookmark_stats.h"
27 #include "chrome/browser/browser_process.h" 27 #include "chrome/browser/browser_process.h"
28 #include "chrome/browser/chrome_notification_types.h" 28 #include "chrome/browser/chrome_notification_types.h"
29 #include "chrome/browser/extensions/extension_util.h" 29 #include "chrome/browser/extensions/extension_util.h"
30 #include "chrome/browser/extensions/tab_helper.h" 30 #include "chrome/browser/extensions/tab_helper.h"
31 #include "chrome/browser/infobars/infobar_service.h" 31 #include "chrome/browser/infobars/infobar_service.h"
32 #include "chrome/browser/native_window_notification_source.h" 32 #include "chrome/browser/native_window_notification_source.h"
33 #include "chrome/browser/profiles/avatar_menu.h" 33 #include "chrome/browser/profiles/avatar_menu.h"
34 #include "chrome/browser/profiles/profile.h" 34 #include "chrome/browser/profiles/profile.h"
35 #include "chrome/browser/profiles/profile_attributes_entry.h"
36 #include "chrome/browser/profiles/profile_attributes_storage.h"
35 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 37 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
36 #include "chrome/browser/profiles/profile_info_cache.h"
37 #include "chrome/browser/profiles/profile_manager.h" 38 #include "chrome/browser/profiles/profile_manager.h"
38 #include "chrome/browser/profiles/profile_window.h" 39 #include "chrome/browser/profiles/profile_window.h"
39 #include "chrome/browser/profiles/profiles_state.h" 40 #include "chrome/browser/profiles/profiles_state.h"
40 #include "chrome/browser/search/search.h" 41 #include "chrome/browser/search/search.h"
41 #include "chrome/browser/sessions/tab_restore_service_factory.h" 42 #include "chrome/browser/sessions/tab_restore_service_factory.h"
42 #include "chrome/browser/signin/chrome_signin_helper.h" 43 #include "chrome/browser/signin/chrome_signin_helper.h"
43 #include "chrome/browser/themes/theme_properties.h" 44 #include "chrome/browser/themes/theme_properties.h"
44 #include "chrome/browser/themes/theme_service.h" 45 #include "chrome/browser/themes/theme_service.h"
45 #include "chrome/browser/translate/chrome_translate_client.h" 46 #include "chrome/browser/translate/chrome_translate_client.h"
46 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" 47 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h"
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 return chrome::MultiUserWindowManager::ShouldShowAvatar( 635 return chrome::MultiUserWindowManager::ShouldShowAvatar(
635 browser_->window()->GetNativeWindow()); 636 browser_->window()->GetNativeWindow());
636 #else 637 #else
637 if (!IsBrowserTypeNormal()) 638 if (!IsBrowserTypeNormal())
638 return false; 639 return false;
639 if (IsOffTheRecord()) // Desktop guest is incognito and needs avatar. 640 if (IsOffTheRecord()) // Desktop guest is incognito and needs avatar.
640 return true; 641 return true;
641 // Tests may not have a profile manager. 642 // Tests may not have a profile manager.
642 if (!g_browser_process->profile_manager()) 643 if (!g_browser_process->profile_manager())
643 return false; 644 return false;
644 ProfileInfoCache& cache = 645 ProfileAttributesEntry* entry;
645 g_browser_process->profile_manager()->GetProfileInfoCache(); 646 if (!g_browser_process->profile_manager()->GetProfileAttributesStorage().
646 if (cache.GetIndexOfProfileWithPath(browser_->profile()->GetPath()) == 647 GetProfileAttributesWithPath(browser_->profile()->GetPath(), &entry)) {
647 std::string::npos) {
648 return false; 648 return false;
649 } 649 }
650 650
651 return AvatarMenu::ShouldShowAvatarMenu(); 651 return AvatarMenu::ShouldShowAvatarMenu();
652 #endif 652 #endif
653 } 653 }
654 654
655 bool BrowserView::GetAccelerator(int cmd_id, 655 bool BrowserView::GetAccelerator(int cmd_id,
656 ui::Accelerator* accelerator) const { 656 ui::Accelerator* accelerator) const {
657 // We retrieve the accelerator information for standard accelerators 657 // We retrieve the accelerator information for standard accelerators
(...skipping 2079 matching lines...) Expand 10 before | Expand all | Expand 10 after
2737 } 2737 }
2738 2738
2739 extensions::ActiveTabPermissionGranter* 2739 extensions::ActiveTabPermissionGranter*
2740 BrowserView::GetActiveTabPermissionGranter() { 2740 BrowserView::GetActiveTabPermissionGranter() {
2741 content::WebContents* web_contents = GetActiveWebContents(); 2741 content::WebContents* web_contents = GetActiveWebContents();
2742 if (!web_contents) 2742 if (!web_contents)
2743 return nullptr; 2743 return nullptr;
2744 return extensions::TabHelper::FromWebContents(web_contents) 2744 return extensions::TabHelper::FromWebContents(web_contents)
2745 ->active_tab_permission_granter(); 2745 ->active_tab_permission_granter();
2746 } 2746 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698