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

Side by Side Diff: chrome/browser/ui/views/frame/browser_view_layout.cc

Issue 2424853003: Remove FOR_EACH_OBSERVER macro usage in chrome/browser/ui (Closed)
Patch Set: explicit types Created 4 years, 2 months 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 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_layout.h" 5 #include "chrome/browser/ui/views/frame/browser_view_layout.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/observer_list.h" 8 #include "base/observer_list.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 class BrowserViewLayout::WebContentsModalDialogHostViews 62 class BrowserViewLayout::WebContentsModalDialogHostViews
63 : public WebContentsModalDialogHost { 63 : public WebContentsModalDialogHost {
64 public: 64 public:
65 explicit WebContentsModalDialogHostViews( 65 explicit WebContentsModalDialogHostViews(
66 BrowserViewLayout* browser_view_layout) 66 BrowserViewLayout* browser_view_layout)
67 : browser_view_layout_(browser_view_layout) { 67 : browser_view_layout_(browser_view_layout) {
68 } 68 }
69 69
70 ~WebContentsModalDialogHostViews() override { 70 ~WebContentsModalDialogHostViews() override {
71 FOR_EACH_OBSERVER(ModalDialogHostObserver, 71 for (ModalDialogHostObserver& observer : observer_list_)
72 observer_list_, 72 observer.OnHostDestroying();
73 OnHostDestroying());
74 } 73 }
75 74
76 void NotifyPositionRequiresUpdate() { 75 void NotifyPositionRequiresUpdate() {
77 FOR_EACH_OBSERVER(ModalDialogHostObserver, 76 for (ModalDialogHostObserver& observer : observer_list_)
78 observer_list_, 77 observer.OnPositionRequiresUpdate();
79 OnPositionRequiresUpdate());
80 } 78 }
81 79
82 gfx::Point GetDialogPosition(const gfx::Size& size) override { 80 gfx::Point GetDialogPosition(const gfx::Size& size) override {
83 views::View* view = browser_view_layout_->contents_container_; 81 views::View* view = browser_view_layout_->contents_container_;
84 gfx::Rect content_area = view->ConvertRectToWidget(view->GetLocalBounds()); 82 gfx::Rect content_area = view->ConvertRectToWidget(view->GetLocalBounds());
85 const int middle_x = content_area.x() + content_area.width() / 2; 83 const int middle_x = content_area.x() + content_area.width() / 2;
86 const int top = browser_view_layout_->web_contents_modal_dialog_top_y_; 84 const int top = browser_view_layout_->web_contents_modal_dialog_top_y_;
87 return gfx::Point(middle_x - size.width() / 2, top); 85 return gfx::Point(middle_x - size.width() / 2, top);
88 } 86 }
89 87
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 return bottom; 537 return bottom;
540 } 538 }
541 539
542 bool BrowserViewLayout::InfobarVisible() const { 540 bool BrowserViewLayout::InfobarVisible() const {
543 // Cast to a views::View to access GetPreferredSize(). 541 // Cast to a views::View to access GetPreferredSize().
544 views::View* infobar_container = infobar_container_; 542 views::View* infobar_container = infobar_container_;
545 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. 543 // NOTE: Can't check if the size IsEmpty() since it's always 0-width.
546 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && 544 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) &&
547 (infobar_container->GetPreferredSize().height() != 0); 545 (infobar_container->GetPreferredSize().height() != 0);
548 } 546 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc ('k') | chrome/browser/ui/views/frame/immersive_mode_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698