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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/panels/test_panel_collection_squeeze_observer.h"
7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/ui/panels/docked_panel_collection.h"
9 #include "chrome/browser/ui/panels/panel.h"
10 #include "content/public/browser/notification_source.h"
12 PanelCollectionSqueezeObserver::PanelCollectionSqueezeObserver(
13 DockedPanelCollection
* collection
, Panel
* active_panel
)
14 : TestPanelNotificationObserver(
15 chrome::NOTIFICATION_PANEL_COLLECTION_UPDATED
,
16 content::Source
<PanelCollection
>(collection
)),
17 panel_collection_(collection
),
18 active_panel_(active_panel
) {
21 PanelCollectionSqueezeObserver::~PanelCollectionSqueezeObserver() {}
23 bool PanelCollectionSqueezeObserver::IsSqueezed(Panel
* panel
) {
24 return panel
->GetBounds().width() < panel
->GetRestoredBounds().width();
27 bool PanelCollectionSqueezeObserver::AtExpectedState() {
28 const DockedPanelCollection::Panels
& panels
= panel_collection_
->panels();
29 for (DockedPanelCollection::Panels::const_iterator iter
= panels
.begin();
30 iter
!= panels
.end(); ++iter
) {
31 if (*iter
== active_panel_
) {
32 if (IsSqueezed(*iter
))
34 } else if (!IsSqueezed(*iter
)) {