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

Side by Side Diff: chrome/browser/ui/views/infobars/extension_infobar.cc

Issue 793783003: Move infobar constants and the code that uses them from components/ to chrome/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NULL -> nullptr Created 6 years 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 unified diff | Download patch
OLDNEW
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/infobars/extension_infobar.h" 5 #include "chrome/browser/ui/views/infobars/extension_infobar.h"
6 6
7 #include "chrome/browser/extensions/extension_context_menu_model.h" 7 #include "chrome/browser/extensions/extension_context_menu_model.h"
8 #include "chrome/browser/extensions/extension_infobar_delegate.h" 8 #include "chrome/browser/extensions/extension_infobar_delegate.h"
9 #include "chrome/browser/extensions/extension_view_host.h" 9 #include "chrome/browser/extensions/extension_view_host.h"
10 #include "chrome/browser/platform_util.h" 10 #include "chrome/browser/platform_util.h"
11 #include "chrome/browser/ui/infobar_container_delegate.h"
11 #include "chrome/browser/ui/views/extensions/extension_view_views.h" 12 #include "chrome/browser/ui/views/extensions/extension_view_views.h"
12 #include "chrome/browser/ui/views/frame/browser_view.h" 13 #include "chrome/browser/ui/views/frame/browser_view.h"
13 #include "extensions/browser/image_loader.h" 14 #include "extensions/browser/image_loader.h"
14 #include "extensions/common/constants.h" 15 #include "extensions/common/constants.h"
15 #include "extensions/common/extension.h" 16 #include "extensions/common/extension.h"
16 #include "extensions/common/extension_icon_set.h" 17 #include "extensions/common/extension_icon_set.h"
17 #include "extensions/common/extension_resource.h" 18 #include "extensions/common/extension_resource.h"
18 #include "extensions/common/manifest_handlers/icons_handler.h" 19 #include "extensions/common/manifest_handlers/icons_handler.h"
19 #include "grit/theme_resources.h" 20 #include "grit/theme_resources.h"
20 #include "ui/base/resource/resource_bundle.h" 21 #include "ui/base/resource/resource_bundle.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 void ExtensionInfoBar::Layout() { 99 void ExtensionInfoBar::Layout() {
99 InfoBarView::Layout(); 100 InfoBarView::Layout();
100 101
101 infobar_icon_->SetPosition(gfx::Point(StartX(), OffsetY(infobar_icon_))); 102 infobar_icon_->SetPosition(gfx::Point(StartX(), OffsetY(infobar_icon_)));
102 ExtensionViewViews* extension_view = GetExtensionView(); 103 ExtensionViewViews* extension_view = GetExtensionView();
103 // TODO(pkasting): We'd like to simply set the extension view's desired height 104 // TODO(pkasting): We'd like to simply set the extension view's desired height
104 // at creation time and position using OffsetY() like for other infobar items, 105 // at creation time and position using OffsetY() like for other infobar items,
105 // but the NativeViewHost inside does not seem to be clipped by the ClipRect() 106 // but the NativeViewHost inside does not seem to be clipped by the ClipRect()
106 // call in InfoBarView::PaintChildren(), so we have to manually clamp the size 107 // call in InfoBarView::PaintChildren(), so we have to manually clamp the size
107 // here. 108 // here.
108 extension_view->SetSize( 109 extension_view->SetSize(gfx::Size(
109 gfx::Size(std::max(0, EndX() - StartX() - NonExtensionViewWidth()), 110 std::max(0, EndX() - StartX() - NonExtensionViewWidth()),
110 std::min(height() - kSeparatorLineHeight - arrow_height(), 111 std::min(
111 GetDelegate()->height()))); 112 height() - InfoBarContainerDelegate::kSeparatorLineHeight -
113 arrow_height(),
114 GetDelegate()->height())));
112 // We do SetPosition() separately after SetSize() so OffsetY() will work. 115 // We do SetPosition() separately after SetSize() so OffsetY() will work.
113 extension_view->SetPosition( 116 extension_view->SetPosition(
114 gfx::Point(infobar_icon_->bounds().right() + kIconHorizontalMargin, 117 gfx::Point(infobar_icon_->bounds().right() + kIconHorizontalMargin,
115 std::max(arrow_height(), OffsetY(extension_view)))); 118 std::max(arrow_height(), OffsetY(extension_view))));
116 } 119 }
117 120
118 void ExtensionInfoBar::ViewHierarchyChanged( 121 void ExtensionInfoBar::ViewHierarchyChanged(
119 const ViewHierarchyChangedDetails& details) { 122 const ViewHierarchyChangedDetails& details) {
120 if (!details.is_add || (details.child != this) || (infobar_icon_ != NULL)) { 123 if (!details.is_add || (details.child != this) || (infobar_icon_ != NULL)) {
121 InfoBarView::ViewHierarchyChanged(details); 124 InfoBarView::ViewHierarchyChanged(details);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 } 229 }
227 230
228 ExtensionViewViews* ExtensionInfoBar::GetExtensionView() { 231 ExtensionViewViews* ExtensionInfoBar::GetExtensionView() {
229 return static_cast<ExtensionViewViews*>( 232 return static_cast<ExtensionViewViews*>(
230 GetDelegate()->extension_view_host()->view()); 233 GetDelegate()->extension_view_host()->view());
231 } 234 }
232 235
233 int ExtensionInfoBar::NonExtensionViewWidth() const { 236 int ExtensionInfoBar::NonExtensionViewWidth() const {
234 return infobar_icon_->width() + kIconHorizontalMargin; 237 return infobar_icon_->width() + kIconHorizontalMargin;
235 } 238 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698