OLD | NEW |
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> |
| 8 |
7 #include <algorithm> | 9 #include <algorithm> |
8 | 10 |
9 #include "base/auto_reset.h" | 11 #include "base/auto_reset.h" |
10 #include "base/command_line.h" | 12 #include "base/command_line.h" |
11 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
12 #include "base/location.h" | 14 #include "base/location.h" |
| 15 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
14 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
15 #include "base/prefs/pref_service.h" | 18 #include "base/prefs/pref_service.h" |
16 #include "base/profiler/scoped_tracker.h" | 19 #include "base/profiler/scoped_tracker.h" |
17 #include "base/single_thread_task_runner.h" | 20 #include "base/single_thread_task_runner.h" |
18 #include "base/strings/string_number_conversions.h" | 21 #include "base/strings/string_number_conversions.h" |
19 #include "base/thread_task_runner_handle.h" | 22 #include "base/thread_task_runner_handle.h" |
| 23 #include "build/build_config.h" |
20 #include "chrome/app/chrome_command_ids.h" | 24 #include "chrome/app/chrome_command_ids.h" |
21 #include "chrome/app/chrome_dll_resource.h" | 25 #include "chrome/app/chrome_dll_resource.h" |
22 #include "chrome/browser/app_mode/app_mode_utils.h" | 26 #include "chrome/browser/app_mode/app_mode_utils.h" |
23 #include "chrome/browser/bookmarks/bookmark_stats.h" | 27 #include "chrome/browser/bookmarks/bookmark_stats.h" |
24 #include "chrome/browser/browser_process.h" | 28 #include "chrome/browser/browser_process.h" |
25 #include "chrome/browser/chrome_notification_types.h" | 29 #include "chrome/browser/chrome_notification_types.h" |
26 #include "chrome/browser/extensions/extension_util.h" | 30 #include "chrome/browser/extensions/extension_util.h" |
27 #include "chrome/browser/extensions/tab_helper.h" | 31 #include "chrome/browser/extensions/tab_helper.h" |
28 #include "chrome/browser/infobars/infobar_service.h" | 32 #include "chrome/browser/infobars/infobar_service.h" |
29 #include "chrome/browser/native_window_notification_source.h" | 33 #include "chrome/browser/native_window_notification_source.h" |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 // As 'hidden' according to the animation is the full in-tab state, we invert | 428 // As 'hidden' according to the animation is the full in-tab state, we invert |
425 // the value - when current_state is at '0', we expect the bar to be docked. | 429 // the value - when current_state is at '0', we expect the bar to be docked. |
426 double current_state = 1 - bookmark_bar_view_->GetAnimationValue(); | 430 double current_state = 1 - bookmark_bar_view_->GetAnimationValue(); |
427 | 431 |
428 if (current_state == 0.0 || current_state == 1.0) { | 432 if (current_state == 0.0 || current_state == 1.0) { |
429 PaintDetachedBookmarkBar(canvas, bookmark_bar_view_, browser_->profile()); | 433 PaintDetachedBookmarkBar(canvas, bookmark_bar_view_, browser_->profile()); |
430 return; | 434 return; |
431 } | 435 } |
432 // While animating, set opacity to cross-fade between attached and detached | 436 // While animating, set opacity to cross-fade between attached and detached |
433 // backgrounds including their respective separators. | 437 // backgrounds including their respective separators. |
434 int detached_alpha = static_cast<uint8>(current_state * 255); | 438 int detached_alpha = static_cast<uint8_t>(current_state * 255); |
435 int attached_alpha = 255 - detached_alpha; | 439 int attached_alpha = 255 - detached_alpha; |
436 if (browser_->bookmark_bar_state() == BookmarkBar::DETACHED) { | 440 if (browser_->bookmark_bar_state() == BookmarkBar::DETACHED) { |
437 // To animate from attached to detached state: | 441 // To animate from attached to detached state: |
438 // - fade out attached background | 442 // - fade out attached background |
439 // - fade in detached background. | 443 // - fade in detached background. |
440 canvas->SaveLayerAlpha(attached_alpha); | 444 canvas->SaveLayerAlpha(attached_alpha); |
441 PaintAttachedBookmarkBar(canvas, | 445 PaintAttachedBookmarkBar(canvas, |
442 bookmark_bar_view_, | 446 bookmark_bar_view_, |
443 browser_view_, | 447 browser_view_, |
444 browser_->host_desktop_type(), | 448 browser_->host_desktop_type(), |
(...skipping 2258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2703 return immersive_mode_controller()->IsEnabled(); | 2707 return immersive_mode_controller()->IsEnabled(); |
2704 } | 2708 } |
2705 | 2709 |
2706 views::Widget* BrowserView::GetBubbleAssociatedWidget() { | 2710 views::Widget* BrowserView::GetBubbleAssociatedWidget() { |
2707 return GetWidget(); | 2711 return GetWidget(); |
2708 } | 2712 } |
2709 | 2713 |
2710 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { | 2714 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { |
2711 return top_container_->GetBoundsInScreen(); | 2715 return top_container_->GetBoundsInScreen(); |
2712 } | 2716 } |
OLD | NEW |