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

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: 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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 return chrome::MultiUserWindowManager::ShouldShowAvatar( 636 return chrome::MultiUserWindowManager::ShouldShowAvatar(
636 browser_->window()->GetNativeWindow()); 637 browser_->window()->GetNativeWindow());
637 #else 638 #else
638 if (!IsBrowserTypeNormal()) 639 if (!IsBrowserTypeNormal())
639 return false; 640 return false;
640 if (IsOffTheRecord()) // Desktop guest is incognito and needs avatar. 641 if (IsOffTheRecord()) // Desktop guest is incognito and needs avatar.
641 return true; 642 return true;
642 // Tests may not have a profile manager. 643 // Tests may not have a profile manager.
643 if (!g_browser_process->profile_manager()) 644 if (!g_browser_process->profile_manager())
644 return false; 645 return false;
645 ProfileInfoCache& cache = 646 ProfileAttributesEntry* entry;
646 g_browser_process->profile_manager()->GetProfileInfoCache(); 647 if (!g_browser_process->profile_manager()->GetProfileAttributesStorage().
647 if (cache.GetIndexOfProfileWithPath(browser_->profile()->GetPath()) == 648 GetProfileAttributesWithPath(browser_->profile()->GetPath(), &entry)) {
lwchkg 2016/02/14 17:07:18 anthonyvd@ and mlerman@: AFAIK profiles either hav
lwchkg 2016/02/24 18:07:27 Forgot to follow-up my own comment. Oh no! Anyway,
Mike Lerman 2016/02/24 18:11:36 In line 629 we explicitly don't skip out GuestProf
Mike Lerman 2016/02/24 18:11:37 Well, Guest and System end up coming down to this
lwchkg 2016/02/24 18:43:18 Well... lines 626-637 is for ChromeOS, and lines 6
Mike Lerman 2016/02/24 20:44:22 I think the current condition is exactly what we n
lwchkg 2016/02/26 15:27:30 Finally I've found why the code was there: return
Mike Lerman 2016/02/26 15:47:49 There isn't one currently. It would be easy to imp
lwchkg 2016/02/26 16:47:33 Found it. There's a IsProfileMarkedForDeletion() i
648 std::string::npos) {
649 return false; 649 return false;
650 } 650 }
651 651
652 return AvatarMenu::ShouldShowAvatarMenu(); 652 return AvatarMenu::ShouldShowAvatarMenu();
653 #endif 653 #endif
654 } 654 }
655 655
656 bool BrowserView::GetAccelerator(int cmd_id, 656 bool BrowserView::GetAccelerator(int cmd_id,
657 ui::Accelerator* accelerator) const { 657 ui::Accelerator* accelerator) const {
658 // We retrieve the accelerator information for standard accelerators 658 // We retrieve the accelerator information for standard accelerators
(...skipping 2078 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