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

Unified Diff: chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc

Issue 1310183009: Add ability for Widgets to override the DefaultThemeProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Only Set ThemeProvider on Top Level Widget Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
diff --git a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
index c1694fb8c8f6d7b0450e2d0d96d226b4a1220567..90af0a58a68d254bdfc269938e3ededecf440380 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
@@ -6,8 +6,11 @@
#include <algorithm>
+#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/search/search.h"
#include "chrome/browser/themes/theme_properties.h"
+#include "chrome/browser/themes/theme_service.h"
+#include "chrome/browser/themes/theme_service_factory.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
#include "chrome/browser/ui/views/omnibox/omnibox_result_view.h"
#include "components/omnibox/browser/omnibox_view.h"
@@ -26,6 +29,10 @@
#include "ui/views/widget/widget.h"
#include "ui/views/window/non_client_view.h"
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
+#endif // OS_CHROMEOS
+
class OmniboxPopupContentsView::AutocompletePopupWidget
: public views::Widget,
public base::SupportsWeakPtr<AutocompletePopupWidget> {
@@ -247,10 +254,25 @@ void OmniboxPopupContentsView::UpdatePopupAppearance() {
#else
views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
#endif
+
+ // On login screen and logged in as an anonymous user you might not get a
oshima 2015/09/10 00:20:38 Is it impossible to have omnibox in login screen,
+ // profile. Which indicates that multi-user is not active and an anonymous
+ // profile is in use. Take the active profile to find the theme.
+ Profile* profile = nullptr;
+#if defined(OS_CHROMEOS)
+ profile =
+ multi_user_util::GetProfileFromWindow(popup_parent->GetNativeWindow());
+ if (!profile)
+ profile = ProfileManager::GetActiveUserProfile();
+#else
+ profile = ProfileManager::GetActiveUserProfile();
+#endif // OS_CHROMEOS
+
params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
params.parent = popup_parent->GetNativeView();
params.bounds = GetPopupBounds();
params.context = popup_parent->GetNativeWindow();
+ params.theme_provider = ThemeServiceFactory::GetForProfile(profile);
popup_->Init(params);
// Third-party software such as DigitalPersona identity verification can
// hook the underlying window creation methods and use SendMessage to

Powered by Google App Engine
This is Rietveld 408576698