Chromium Code Reviews| 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/exclusive_access_bubble_views.h" | 5 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/strings/string_split.h" | 11 #include "base/strings/string_split.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "chrome/app/chrome_command_ids.h" | 14 #include "chrome/app/chrome_command_ids.h" |
| 15 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
| 16 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" | 16 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" |
| 17 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" | 17 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
| 18 #include "chrome/browser/ui/views/exclusive_access_bubble_views_context.h" | 18 #include "chrome/browser/ui/views/exclusive_access_bubble_views_context.h" |
| 19 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" | 19 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
| 20 #include "chrome/browser/ui/views/frame/top_container_view.h" | 20 #include "chrome/browser/ui/views/frame/top_container_view.h" |
| 21 #include "chrome/grit/generated_resources.h" | 21 #include "chrome/grit/generated_resources.h" |
| 22 #include "content/public/browser/notification_service.h" | 22 #include "content/public/browser/notification_service.h" |
| 23 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 24 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
| 25 #include "ui/events/keycodes/keyboard_codes.h" | 25 #include "ui/events/keycodes/keyboard_codes.h" |
| 26 #include "ui/gfx/animation/slide_animation.h" | 26 #include "ui/gfx/animation/slide_animation.h" |
| 27 #include "ui/gfx/canvas.h" | 27 #include "ui/gfx/canvas.h" |
| 28 #include "ui/native_theme/native_theme.h" | 28 #include "ui/native_theme/native_theme.h" |
|
Evan Stade
2016/05/17 00:23:23
you can remove this now
Matt Giuca
2016/05/17 00:58:01
Sorry, I realised this after the CL went through.
| |
| 29 #include "ui/strings/grit/ui_strings.h" | 29 #include "ui/strings/grit/ui_strings.h" |
| 30 #include "ui/views/bubble/bubble_border.h" | 30 #include "ui/views/bubble/bubble_border.h" |
| 31 #include "ui/views/controls/button/label_button.h" | 31 #include "ui/views/controls/button/label_button.h" |
| 32 #include "ui/views/controls/link.h" | 32 #include "ui/views/controls/link.h" |
| 33 #include "ui/views/controls/link_listener.h" | 33 #include "ui/views/controls/link_listener.h" |
| 34 #include "ui/views/layout/box_layout.h" | 34 #include "ui/views/layout/box_layout.h" |
| 35 #include "ui/views/view.h" | 35 #include "ui/views/view.h" |
| 36 #include "ui/views/widget/widget.h" | 36 #include "ui/views/widget/widget.h" |
| 37 #include "url/gurl.h" | 37 #include "url/gurl.h" |
| 38 | 38 |
| 39 #if defined(OS_WIN) | 39 #if defined(OS_WIN) |
| 40 #include "ui/base/l10n/l10n_util_win.h" | 40 #include "ui/base/l10n/l10n_util_win.h" |
| 41 #endif | 41 #endif |
| 42 | 42 |
| 43 // ExclusiveAccessView --------------------------------------------------------- | 43 // ExclusiveAccessView --------------------------------------------------------- |
| 44 | 44 |
| 45 namespace { | 45 namespace { |
| 46 | 46 |
| 47 // Space between the site info label and the buttons / link. | 47 // Space between the site info label and the buttons / link. |
| 48 const int kMiddlePaddingPx = 30; | 48 const int kMiddlePaddingPx = 30; |
| 49 | 49 |
| 50 const int kOuterPaddingHorizPx = 40; | 50 const int kOuterPaddingHorizPx = 40; |
| 51 const int kOuterPaddingVertPx = 8; | 51 const int kOuterPaddingVertPx = 8; |
| 52 | 52 |
| 53 // Partially-transparent background color. Only used with | 53 // Partially-transparent background color. |
| 54 // IsSimplifiedFullscreenUIEnabled. | |
| 55 const SkColor kBackgroundColor = SkColorSetARGB(0xcc, 0x28, 0x2c, 0x32); | 54 const SkColor kBackgroundColor = SkColorSetARGB(0xcc, 0x28, 0x2c, 0x32); |
| 56 | 55 |
| 57 class ButtonView : public views::View { | 56 class ButtonView : public views::View { |
| 58 public: | 57 public: |
| 59 ButtonView(views::ButtonListener* listener, int between_button_spacing); | 58 ButtonView(views::ButtonListener* listener, int between_button_spacing); |
| 60 ~ButtonView() override; | 59 ~ButtonView() override; |
| 61 | 60 |
| 62 views::LabelButton* accept_button() const { return accept_button_; } | 61 views::LabelButton* accept_button() const { return accept_button_; } |
| 63 views::LabelButton* deny_button() const { return deny_button_; } | 62 views::LabelButton* deny_button() const { return deny_button_; } |
| 64 | 63 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 private: | 203 private: |
| 205 ExclusiveAccessBubbleViews* bubble_; | 204 ExclusiveAccessBubbleViews* bubble_; |
| 206 | 205 |
| 207 // Clickable hint text for exiting fullscreen mode. (Non-simplified mode | 206 // Clickable hint text for exiting fullscreen mode. (Non-simplified mode |
| 208 // only.) | 207 // only.) |
| 209 views::Link* link_; | 208 views::Link* link_; |
| 210 // Informational label: 'www.foo.com has gone fullscreen'. (Non-simplified | 209 // Informational label: 'www.foo.com has gone fullscreen'. (Non-simplified |
| 211 // mode only.) | 210 // mode only.) |
| 212 views::Label* message_label_; | 211 views::Label* message_label_; |
| 213 // Clickable buttons to exit fullscreen. (Non-simplified mode only.) | 212 // Clickable buttons to exit fullscreen. (Non-simplified mode only.) |
| 213 // TODO(mgiuca): Delete this; it is no longer used on any code path. | |
| 214 ButtonView* button_view_; | 214 ButtonView* button_view_; |
| 215 // Instruction for exiting fullscreen / mouse lock. Only present if there is | 215 // Instruction for exiting fullscreen / mouse lock. Only present if there is |
| 216 // no link or button (always present in simplified mode). | 216 // no link or button (always present in simplified mode). |
| 217 InstructionView* exit_instruction_; | 217 InstructionView* exit_instruction_; |
| 218 const base::string16 browser_fullscreen_exit_accelerator_; | 218 const base::string16 browser_fullscreen_exit_accelerator_; |
| 219 | 219 |
| 220 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessView); | 220 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessView); |
| 221 }; | 221 }; |
| 222 | 222 |
| 223 ExclusiveAccessBubbleViews::ExclusiveAccessView::ExclusiveAccessView( | 223 ExclusiveAccessBubbleViews::ExclusiveAccessView::ExclusiveAccessView( |
| 224 ExclusiveAccessBubbleViews* bubble, | 224 ExclusiveAccessBubbleViews* bubble, |
| 225 const base::string16& accelerator, | 225 const base::string16& accelerator, |
| 226 const GURL& url, | 226 const GURL& url, |
| 227 ExclusiveAccessBubbleType bubble_type) | 227 ExclusiveAccessBubbleType bubble_type) |
| 228 : bubble_(bubble), | 228 : bubble_(bubble), |
| 229 link_(nullptr), | 229 link_(nullptr), |
| 230 message_label_(nullptr), | 230 message_label_(nullptr), |
| 231 button_view_(nullptr), | 231 button_view_(nullptr), |
| 232 exit_instruction_(nullptr), | 232 exit_instruction_(nullptr), |
| 233 browser_fullscreen_exit_accelerator_(accelerator) { | 233 browser_fullscreen_exit_accelerator_(accelerator) { |
| 234 views::BubbleBorder::Shadow shadow_type = views::BubbleBorder::BIG_SHADOW; | 234 const SkColor kForegroundColor = SK_ColorWHITE; |
| 235 #if defined(OS_LINUX) | |
| 236 // Use a smaller shadow on Linux (including ChromeOS) as the shadow assets can | |
| 237 // overlap each other in a fullscreen notification bubble. | |
| 238 // See http://crbug.com/462983. | |
| 239 shadow_type = views::BubbleBorder::SMALL_SHADOW; | |
| 240 #endif | |
| 241 if (ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) | |
| 242 shadow_type = views::BubbleBorder::NO_ASSETS; | |
| 243 | |
| 244 // TODO(estade): don't use this static instance. See http://crbug.com/558162 | |
| 245 ui::NativeTheme* theme = ui::NativeTheme::GetInstanceForWeb(); | |
| 246 SkColor background_color = | |
| 247 ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled() | |
| 248 ? kBackgroundColor | |
| 249 : theme->GetSystemColor(ui::NativeTheme::kColorId_BubbleBackground); | |
| 250 SkColor foreground_color = | |
| 251 ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled() | |
| 252 ? SK_ColorWHITE | |
| 253 : theme->GetSystemColor(ui::NativeTheme::kColorId_LabelEnabledColor); | |
| 254 | 235 |
| 255 std::unique_ptr<views::BubbleBorder> bubble_border(new views::BubbleBorder( | 236 std::unique_ptr<views::BubbleBorder> bubble_border(new views::BubbleBorder( |
| 256 views::BubbleBorder::NONE, shadow_type, background_color)); | 237 views::BubbleBorder::NONE, views::BubbleBorder::NO_ASSETS, |
| 238 kBackgroundColor)); | |
| 257 set_background(new views::BubbleBackground(bubble_border.get())); | 239 set_background(new views::BubbleBackground(bubble_border.get())); |
| 258 SetBorder(std::move(bubble_border)); | 240 SetBorder(std::move(bubble_border)); |
| 259 | 241 |
| 260 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 242 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 261 const gfx::FontList& font_list = | 243 const gfx::FontList& font_list = |
| 262 rb.GetFontList(ui::ResourceBundle::MediumFont); | 244 rb.GetFontList(ui::ResourceBundle::MediumFont); |
| 263 | 245 |
| 264 if (!ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) { | 246 if (!ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) { |
| 265 message_label_ = new views::Label(base::string16(), font_list); | 247 message_label_ = new views::Label(base::string16(), font_list); |
| 266 message_label_->SetEnabledColor(foreground_color); | 248 message_label_->SetEnabledColor(kForegroundColor); |
| 267 message_label_->SetBackgroundColor(background_color); | 249 message_label_->SetBackgroundColor(kBackgroundColor); |
| 268 } | 250 } |
| 269 | 251 |
| 270 exit_instruction_ = new InstructionView(base::string16(), font_list, | 252 exit_instruction_ = new InstructionView(base::string16(), font_list, |
| 271 foreground_color, background_color); | 253 kForegroundColor, kBackgroundColor); |
| 272 | 254 |
| 273 link_ = new views::Link(); | 255 link_ = new views::Link(); |
| 274 link_->SetFocusBehavior(FocusBehavior::NEVER); | 256 link_->SetFocusBehavior(FocusBehavior::NEVER); |
| 275 #if defined(OS_CHROMEOS) | 257 #if defined(OS_CHROMEOS) |
| 276 // On CrOS, the link text doesn't change, since it doesn't show the shortcut. | 258 // On CrOS, the link text doesn't change, since it doesn't show the shortcut. |
| 277 link_->SetText(l10n_util::GetStringUTF16(IDS_EXIT_FULLSCREEN_MODE)); | 259 link_->SetText(l10n_util::GetStringUTF16(IDS_EXIT_FULLSCREEN_MODE)); |
| 278 #endif | 260 #endif |
| 279 link_->set_listener(this); | 261 link_->set_listener(this); |
| 280 link_->SetFontList(font_list); | 262 link_->SetFontList(font_list); |
| 281 link_->SetPressedColor(foreground_color); | 263 link_->SetPressedColor(kForegroundColor); |
| 282 link_->SetEnabledColor(foreground_color); | 264 link_->SetEnabledColor(kForegroundColor); |
| 283 link_->SetBackgroundColor(background_color); | 265 link_->SetBackgroundColor(kBackgroundColor); |
| 284 link_->SetVisible(false); | 266 link_->SetVisible(false); |
| 285 | 267 |
| 286 button_view_ = new ButtonView(this, kPaddingPx); | 268 button_view_ = new ButtonView(this, kPaddingPx); |
| 287 | 269 |
| 288 int outer_padding_horiz = kOuterPaddingHorizPx; | 270 int outer_padding_horiz = kOuterPaddingHorizPx; |
| 289 int outer_padding_vert = kOuterPaddingVertPx; | 271 int outer_padding_vert = kOuterPaddingVertPx; |
| 290 if (!ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) { | 272 if (!ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) { |
| 291 DCHECK(message_label_); | 273 DCHECK(message_label_); |
| 292 AddChildView(message_label_); | 274 AddChildView(message_label_); |
| 293 | |
| 294 outer_padding_horiz = kPaddingPx; | |
| 295 outer_padding_vert = kPaddingPx; | |
| 296 } | 275 } |
| 297 AddChildView(button_view_); | 276 AddChildView(button_view_); |
| 298 AddChildView(exit_instruction_); | 277 AddChildView(exit_instruction_); |
| 299 AddChildView(link_); | 278 AddChildView(link_); |
| 300 | 279 |
| 301 views::BoxLayout* layout = | 280 views::BoxLayout* layout = |
| 302 new views::BoxLayout(views::BoxLayout::kHorizontal, outer_padding_horiz, | 281 new views::BoxLayout(views::BoxLayout::kHorizontal, outer_padding_horiz, |
| 303 outer_padding_vert, kMiddlePaddingPx); | 282 outer_padding_vert, kMiddlePaddingPx); |
| 304 SetLayoutManager(layout); | 283 SetLayoutManager(layout); |
| 305 | 284 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 322 views::Link* link, | 301 views::Link* link, |
| 323 int event_flags) { | 302 int event_flags) { |
| 324 bubble_->ExitExclusiveAccess(); | 303 bubble_->ExitExclusiveAccess(); |
| 325 } | 304 } |
| 326 | 305 |
| 327 void ExclusiveAccessBubbleViews::ExclusiveAccessView::UpdateContent( | 306 void ExclusiveAccessBubbleViews::ExclusiveAccessView::UpdateContent( |
| 328 const GURL& url, | 307 const GURL& url, |
| 329 ExclusiveAccessBubbleType bubble_type) { | 308 ExclusiveAccessBubbleType bubble_type) { |
| 330 DCHECK_NE(EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE, bubble_type); | 309 DCHECK_NE(EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE, bubble_type); |
| 331 | 310 |
| 332 if (!ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) { | 311 bool link_visible = |
| 333 DCHECK(message_label_); | 312 !ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled(); |
| 334 message_label_->SetText(bubble_->GetCurrentMessageText()); | 313 base::string16 accelerator; |
| 314 if (bubble_type == | |
| 315 EXCLUSIVE_ACCESS_BUBBLE_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION || | |
| 316 bubble_type == | |
| 317 EXCLUSIVE_ACCESS_BUBBLE_TYPE_EXTENSION_FULLSCREEN_EXIT_INSTRUCTION) { | |
| 318 accelerator = browser_fullscreen_exit_accelerator_; | |
| 319 } else { | |
| 320 accelerator = l10n_util::GetStringUTF16(IDS_APP_ESC_KEY); | |
| 321 if (bubble_type != | |
| 322 EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_EXIT_INSTRUCTION) { | |
| 323 link_visible = false; | |
| 324 } | |
| 335 } | 325 } |
| 336 | |
| 337 if (exclusive_access_bubble::ShowButtonsForType(bubble_type)) { | |
| 338 link_->SetVisible(false); | |
| 339 exit_instruction_->SetVisible(false); | |
| 340 button_view_->SetVisible(true); | |
| 341 button_view_->deny_button()->SetText(bubble_->GetCurrentDenyButtonText()); | |
| 342 button_view_->deny_button()->SetMinSize(gfx::Size()); | |
| 343 button_view_->accept_button()->SetText( | |
| 344 bubble_->GetCurrentAllowButtonText()); | |
| 345 button_view_->accept_button()->SetMinSize(gfx::Size()); | |
| 346 } else { | |
| 347 bool link_visible = | |
| 348 !ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled(); | |
| 349 base::string16 accelerator; | |
| 350 if (bubble_type == | |
| 351 EXCLUSIVE_ACCESS_BUBBLE_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION || | |
| 352 bubble_type == | |
| 353 EXCLUSIVE_ACCESS_BUBBLE_TYPE_EXTENSION_FULLSCREEN_EXIT_INSTRUCTION) { | |
| 354 accelerator = browser_fullscreen_exit_accelerator_; | |
| 355 } else { | |
| 356 accelerator = l10n_util::GetStringUTF16(IDS_APP_ESC_KEY); | |
| 357 if (bubble_type != | |
| 358 EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_EXIT_INSTRUCTION) { | |
| 359 link_visible = false; | |
| 360 } | |
| 361 } | |
| 362 #if !defined(OS_CHROMEOS) | 326 #if !defined(OS_CHROMEOS) |
| 363 if (link_visible) { | 327 if (link_visible) { |
| 364 link_->SetText(l10n_util::GetStringUTF16(IDS_EXIT_FULLSCREEN_MODE) + | 328 link_->SetText(l10n_util::GetStringUTF16(IDS_EXIT_FULLSCREEN_MODE) + |
| 365 base::UTF8ToUTF16(" ") + | 329 base::UTF8ToUTF16(" ") + |
| 366 l10n_util::GetStringFUTF16( | 330 l10n_util::GetStringFUTF16( |
| 367 IDS_EXIT_FULLSCREEN_MODE_ACCELERATOR, accelerator)); | 331 IDS_EXIT_FULLSCREEN_MODE_ACCELERATOR, accelerator)); |
| 368 } | 332 } |
| 369 #endif | 333 #endif |
| 370 link_->SetVisible(link_visible); | 334 link_->SetVisible(link_visible); |
| 371 exit_instruction_->SetText(bubble_->GetInstructionText(accelerator)); | 335 exit_instruction_->SetText(bubble_->GetInstructionText(accelerator)); |
| 372 exit_instruction_->SetVisible(!link_visible); | 336 exit_instruction_->SetVisible(!link_visible); |
| 373 button_view_->SetVisible(false); | 337 button_view_->SetVisible(false); |
| 374 } | |
| 375 } | 338 } |
| 376 | 339 |
| 377 // ExclusiveAccessBubbleViews -------------------------------------------------- | 340 // ExclusiveAccessBubbleViews -------------------------------------------------- |
| 378 | 341 |
| 379 ExclusiveAccessBubbleViews::ExclusiveAccessBubbleViews( | 342 ExclusiveAccessBubbleViews::ExclusiveAccessBubbleViews( |
| 380 ExclusiveAccessBubbleViewsContext* context, | 343 ExclusiveAccessBubbleViewsContext* context, |
| 381 const GURL& url, | 344 const GURL& url, |
| 382 ExclusiveAccessBubbleType bubble_type) | 345 ExclusiveAccessBubbleType bubble_type) |
| 383 : ExclusiveAccessBubble(context->GetExclusiveAccessManager(), | 346 : ExclusiveAccessBubble(context->GetExclusiveAccessManager(), |
| 384 url, | 347 url, |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 483 if (popup_->IsVisible()) | 446 if (popup_->IsVisible()) |
| 484 UpdateBounds(); | 447 UpdateBounds(); |
| 485 } | 448 } |
| 486 | 449 |
| 487 views::View* ExclusiveAccessBubbleViews::GetView() { | 450 views::View* ExclusiveAccessBubbleViews::GetView() { |
| 488 return view_; | 451 return view_; |
| 489 } | 452 } |
| 490 | 453 |
| 491 ExclusiveAccessBubbleViews::AnimatedAttribute | 454 ExclusiveAccessBubbleViews::AnimatedAttribute |
| 492 ExclusiveAccessBubbleViews::ExpectedAnimationAttribute() { | 455 ExclusiveAccessBubbleViews::ExpectedAnimationAttribute() { |
| 493 return ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled() || | 456 // TODO(mgiuca): Delete this function. |
| 494 bubble_view_context_->IsImmersiveModeEnabled() | 457 return ANIMATED_ATTRIBUTE_OPACITY; |
| 495 ? ANIMATED_ATTRIBUTE_OPACITY | |
| 496 : ANIMATED_ATTRIBUTE_BOUNDS; | |
| 497 } | 458 } |
| 498 | 459 |
| 499 void ExclusiveAccessBubbleViews::UpdateMouseWatcher() { | 460 void ExclusiveAccessBubbleViews::UpdateMouseWatcher() { |
| 500 bool should_watch_mouse = false; | 461 bool should_watch_mouse = false; |
| 501 if (popup_->IsVisible()) | 462 if (popup_->IsVisible()) |
| 502 should_watch_mouse = | 463 should_watch_mouse = |
| 503 !exclusive_access_bubble::ShowButtonsForType(bubble_type_); | 464 !exclusive_access_bubble::ShowButtonsForType(bubble_type_); |
| 504 else | 465 else |
| 505 should_watch_mouse = CanMouseTriggerSlideIn(); | 466 should_watch_mouse = CanMouseTriggerSlideIn(); |
| 506 | 467 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 586 // - Querying the top container height may return the height before entering | 547 // - Querying the top container height may return the height before entering |
| 587 // fullscreen because layout is disabled while entering fullscreen. | 548 // fullscreen because layout is disabled while entering fullscreen. |
| 588 // A visual glitch due to the delayed layout is avoided in immersive | 549 // A visual glitch due to the delayed layout is avoided in immersive |
| 589 // fullscreen because entering fullscreen starts with the top container | 550 // fullscreen because entering fullscreen starts with the top container |
| 590 // revealed. When revealed, the top container has the same height as before | 551 // revealed. When revealed, the top container has the same height as before |
| 591 // entering fullscreen. | 552 // entering fullscreen. |
| 592 top_container_bottom = | 553 top_container_bottom = |
| 593 bubble_view_context_->GetTopContainerBoundsInScreen().bottom(); | 554 bubble_view_context_->GetTopContainerBoundsInScreen().bottom(); |
| 594 } | 555 } |
| 595 // |desired_top| is the top of the bubble area including the shadow. | 556 // |desired_top| is the top of the bubble area including the shadow. |
| 596 int popup_top = ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled() | 557 int desired_top = kSimplifiedPopupTopPx - view_->border()->GetInsets().top(); |
| 597 ? kSimplifiedPopupTopPx | |
| 598 : kPopupTopPx; | |
| 599 int desired_top = popup_top - view_->border()->GetInsets().top(); | |
| 600 int y = top_container_bottom + desired_top; | 558 int y = top_container_bottom + desired_top; |
| 601 | 559 |
| 602 if (!ignore_animation_state && | 560 if (!ignore_animation_state && |
| 603 animated_attribute_ == ANIMATED_ATTRIBUTE_BOUNDS) { | 561 animated_attribute_ == ANIMATED_ATTRIBUTE_BOUNDS) { |
| 604 int total_height = size.height() + desired_top; | 562 int total_height = size.height() + desired_top; |
| 605 int popup_bottom = animation_->CurrentValueBetween(total_height, 0); | 563 int popup_bottom = animation_->CurrentValueBetween(total_height, 0); |
| 606 int y_offset = std::min(popup_bottom, desired_top); | 564 int y_offset = std::min(popup_bottom, desired_top); |
| 607 size.set_height(size.height() - popup_bottom + y_offset); | 565 size.set_height(size.height() - popup_bottom + y_offset); |
| 608 y -= y_offset; | 566 y -= y_offset; |
| 609 } | 567 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 646 const content::NotificationDetails& details) { | 604 const content::NotificationDetails& details) { |
| 647 DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type); | 605 DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type); |
| 648 UpdateForImmersiveState(); | 606 UpdateForImmersiveState(); |
| 649 } | 607 } |
| 650 | 608 |
| 651 void ExclusiveAccessBubbleViews::OnWidgetVisibilityChanged( | 609 void ExclusiveAccessBubbleViews::OnWidgetVisibilityChanged( |
| 652 views::Widget* widget, | 610 views::Widget* widget, |
| 653 bool visible) { | 611 bool visible) { |
| 654 UpdateMouseWatcher(); | 612 UpdateMouseWatcher(); |
| 655 } | 613 } |
| OLD | NEW |