| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/metrics/user_metrics.h" | 10 #include "base/metrics/user_metrics.h" |
| 11 #include "base/metrics/user_metrics_action.h" | 11 #include "base/metrics/user_metrics_action.h" |
| 12 #include "chrome/browser/extensions/extension_action_manager.h" | 12 #include "chrome/browser/extensions/extension_action_manager.h" |
| 13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/chrome_pages.h" | 14 #include "chrome/browser/ui/chrome_pages.h" |
| 15 #include "chrome/browser/ui/extensions/extension_installed_bubble.h" | 15 #include "chrome/browser/ui/extensions/extension_installed_bubble.h" |
| 16 #include "chrome/browser/ui/singleton_tabs.h" | 16 #include "chrome/browser/ui/singleton_tabs.h" |
| 17 #include "chrome/browser/ui/sync/bubble_sync_promo_delegate.h" | 17 #include "chrome/browser/ui/sync/bubble_sync_promo_delegate.h" |
| 18 #include "chrome/browser/ui/views/frame/browser_view.h" | 18 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 19 #include "chrome/browser/ui/views/harmony/layout_delegate.h" | 19 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
| 20 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 20 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 21 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 21 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
| 22 #include "chrome/browser/ui/views/sync/bubble_sync_promo_view.h" | 22 #include "chrome/browser/ui/views/sync/bubble_sync_promo_view.h" |
| 23 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" | 23 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" |
| 24 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" | 24 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
| 25 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 25 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
| 26 #include "chrome/common/url_constants.h" | 26 #include "chrome/common/url_constants.h" |
| 27 #include "chrome/grit/chromium_strings.h" | 27 #include "chrome/grit/chromium_strings.h" |
| 28 #include "chrome/grit/generated_resources.h" | 28 #include "chrome/grit/generated_resources.h" |
| 29 #include "components/bubble/bubble_controller.h" | 29 #include "components/bubble/bubble_controller.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 // ------------------------- | 200 // ------------------------- |
| 201 // | 201 // |
| 202 // Icon and Title are always shown (as well as the close button). | 202 // Icon and Title are always shown (as well as the close button). |
| 203 // Info is shown for browser actions, page actions and Omnibox keyword | 203 // Info is shown for browser actions, page actions and Omnibox keyword |
| 204 // extensions and might list keyboard shorcut for the former two types. | 204 // extensions and might list keyboard shorcut for the former two types. |
| 205 // Extra info is... | 205 // Extra info is... |
| 206 // ... for other types, either a description of how to manage the extension | 206 // ... for other types, either a description of how to manage the extension |
| 207 // or a link to configure the keybinding shortcut (if one exists). | 207 // or a link to configure the keybinding shortcut (if one exists). |
| 208 // Extra info can include a promo for signing into sync. | 208 // Extra info can include a promo for signing into sync. |
| 209 | 209 |
| 210 LayoutDelegate* layout_delegate = LayoutDelegate::Get(); | 210 ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); |
| 211 std::unique_ptr<views::BoxLayout> layout(new views::BoxLayout( | 211 std::unique_ptr<views::BoxLayout> layout(new views::BoxLayout( |
| 212 views::BoxLayout::kVertical, 0, 0, | 212 views::BoxLayout::kVertical, 0, 0, |
| 213 layout_delegate->GetMetric( | 213 provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL))); |
| 214 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING))); | |
| 215 layout->set_minimum_cross_axis_size(kRightColumnWidth); | 214 layout->set_minimum_cross_axis_size(kRightColumnWidth); |
| 216 // Indent by the size of the icon. | 215 // Indent by the size of the icon. |
| 217 layout->set_inside_border_insets(gfx::Insets( | 216 layout->set_inside_border_insets(gfx::Insets( |
| 218 0, | 217 0, |
| 219 GetIconSize().width() + | 218 GetIconSize().width() + |
| 220 layout_delegate->GetMetric( | 219 provider->GetDistanceMetric(DISTANCE_UNRELATED_CONTROL_HORIZONTAL), |
| 221 LayoutDelegate::Metric::UNRELATED_CONTROL_HORIZONTAL_SPACING), | |
| 222 0, 0)); | 220 0, 0)); |
| 223 layout->set_cross_axis_alignment( | 221 layout->set_cross_axis_alignment( |
| 224 views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); | 222 views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); |
| 225 SetLayoutManager(layout.release()); | 223 SetLayoutManager(layout.release()); |
| 226 | 224 |
| 227 if (controller_->options() & ExtensionInstalledBubble::HOW_TO_USE) | 225 if (controller_->options() & ExtensionInstalledBubble::HOW_TO_USE) |
| 228 AddChildView(CreateLabel(controller_->GetHowToUseDescription())); | 226 AddChildView(CreateLabel(controller_->GetHowToUseDescription())); |
| 229 | 227 |
| 230 if (controller_->options() & ExtensionInstalledBubble::SHOW_KEYBINDING) { | 228 if (controller_->options() & ExtensionInstalledBubble::SHOW_KEYBINDING) { |
| 231 manage_shortcut_ = new views::Link( | 229 manage_shortcut_ = new views::Link( |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 ->browser_actions(); | 336 ->browser_actions(); |
| 339 return !container->animating(); | 337 return !container->animating(); |
| 340 } | 338 } |
| 341 return true; | 339 return true; |
| 342 } | 340 } |
| 343 | 341 |
| 344 // Implemented here to create the platform specific instance of the BubbleUi. | 342 // Implemented here to create the platform specific instance of the BubbleUi. |
| 345 std::unique_ptr<BubbleUi> ExtensionInstalledBubble::BuildBubbleUi() { | 343 std::unique_ptr<BubbleUi> ExtensionInstalledBubble::BuildBubbleUi() { |
| 346 return base::WrapUnique(new ExtensionInstalledBubbleUi(this)); | 344 return base::WrapUnique(new ExtensionInstalledBubbleUi(this)); |
| 347 } | 345 } |
| OLD | NEW |