OLD | NEW |
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/glass_browser_frame_view.h" | 5 #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 // must be called prior to LayoutProfileSwitcher(). | 425 // must be called prior to LayoutProfileSwitcher(). |
426 LayoutCaptionButtons(); | 426 LayoutCaptionButtons(); |
427 LayoutTitleBar(); | 427 LayoutTitleBar(); |
428 } | 428 } |
429 if (browser_view()->IsRegularOrGuestSession()) | 429 if (browser_view()->IsRegularOrGuestSession()) |
430 LayoutProfileSwitcher(); | 430 LayoutProfileSwitcher(); |
431 LayoutIncognitoIcon(); | 431 LayoutIncognitoIcon(); |
432 LayoutClientView(); | 432 LayoutClientView(); |
433 } | 433 } |
434 | 434 |
435 void GlassBrowserFrameView::ChildPreferredSizeChanged(views::View* child) { | |
436 if (child == GetProfileSwitcherView()) { | |
437 // Need to layout the root view here, too, as the avatar button may change | |
438 // between the text and the icon when a profile is added or removed, which | |
439 // changes its width. This may cause it to start or stop overlapping the | |
440 // the tabstrip horizontally, which in turn causes it to change height, as | |
441 // calculated in LayoutProfileSwitcher(). Calling LayoutProfileSwitcher() | |
442 // is not enough here - it does not re-draw the line below the tabstrip | |
443 // properly when a profile is added or removed. Even adding | |
444 // browser_view()->tabstrip()->Layout() and SchedulePaint() is not enough. | |
445 // TODO(bsep): Figure out the most efficient way to do this. | |
446 frame()->GetRootView()->Layout(); | |
447 } | |
448 } | |
449 | |
450 /////////////////////////////////////////////////////////////////////////////// | 435 /////////////////////////////////////////////////////////////////////////////// |
451 // GlassBrowserFrameView, protected: | 436 // GlassBrowserFrameView, protected: |
452 | 437 |
453 // BrowserNonClientFrameView: | 438 // BrowserNonClientFrameView: |
454 void GlassBrowserFrameView::UpdateProfileIcons() { | 439 void GlassBrowserFrameView::UpdateProfileIcons() { |
455 if (browser_view()->IsRegularOrGuestSession()) | 440 if (browser_view()->IsRegularOrGuestSession()) |
456 profile_switcher_.Update(AvatarButtonStyle::NATIVE); | 441 profile_switcher_.Update(AvatarButtonStyle::NATIVE); |
457 else | 442 else |
458 UpdateProfileIndicatorIcon(); | 443 UpdateProfileIndicatorIcon(); |
459 } | 444 } |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 static bool initialized = false; | 951 static bool initialized = false; |
967 if (!initialized) { | 952 if (!initialized) { |
968 for (int i = 0; i < kThrobberIconCount; ++i) { | 953 for (int i = 0; i < kThrobberIconCount; ++i) { |
969 throbber_icons_[i] = | 954 throbber_icons_[i] = |
970 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); | 955 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); |
971 DCHECK(throbber_icons_[i]); | 956 DCHECK(throbber_icons_[i]); |
972 } | 957 } |
973 initialized = true; | 958 initialized = true; |
974 } | 959 } |
975 } | 960 } |
OLD | NEW |