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

Side by Side Diff: chrome/browser/views/browser_actions_container.cc

Issue 3056003: Attemp 2 at: (Closed)
Patch Set: Fix chromeos breakage Created 10 years, 5 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
« no previous file with comments | « chrome/browser/views/bookmark_bar_view.cc ('k') | chrome/browser/views/frame/browser_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/views/browser_actions_container.h" 5 #include "chrome/browser/views/browser_actions_container.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "app/slide_animation.h" 9 #include "app/slide_animation.h"
10 #include "base/stl_util-inl.h" 10 #include "base/stl_util-inl.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "chrome/browser/browser.h" 12 #include "chrome/browser/browser.h"
13 #include "chrome/browser/browser_theme_provider.h" 13 #include "chrome/browser/browser_theme_provider.h"
14 #include "chrome/browser/browser_window.h" 14 #include "chrome/browser/browser_window.h"
15 #include "chrome/browser/extensions/extension_browser_event_router.h" 15 #include "chrome/browser/extensions/extension_browser_event_router.h"
16 #include "chrome/browser/extensions/extension_host.h" 16 #include "chrome/browser/extensions/extension_host.h"
17 #include "chrome/browser/extensions/extensions_service.h" 17 #include "chrome/browser/extensions/extensions_service.h"
18 #include "chrome/browser/extensions/extension_tabs_module.h" 18 #include "chrome/browser/extensions/extension_tabs_module.h"
19 #include "chrome/browser/renderer_host/render_widget_host_view.h" 19 #include "chrome/browser/renderer_host/render_widget_host_view.h"
20 #include "chrome/browser/renderer_host/render_view_host.h" 20 #include "chrome/browser/renderer_host/render_view_host.h"
21 #include "chrome/browser/profile.h" 21 #include "chrome/browser/profile.h"
22 #include "chrome/browser/tab_contents/tab_contents.h" 22 #include "chrome/browser/tab_contents/tab_contents.h"
23 #include "chrome/browser/view_ids.h" 23 #include "chrome/browser/view_ids.h"
24 #include "chrome/browser/views/detachable_toolbar_view.h" 24 #include "chrome/browser/views/detachable_toolbar_view.h"
25 #include "chrome/browser/views/extensions/browser_action_drag_data.h" 25 #include "chrome/browser/views/extensions/browser_action_drag_data.h"
26 #include "chrome/browser/views/extensions/extension_popup.h" 26 #include "chrome/browser/views/extensions/extension_popup.h"
27 #include "chrome/browser/views/toolbar_view.h"
28 #include "chrome/common/extensions/extension_action.h" 27 #include "chrome/common/extensions/extension_action.h"
29 #include "chrome/common/extensions/extension_resource.h" 28 #include "chrome/common/extensions/extension_resource.h"
30 #include "chrome/common/notification_source.h" 29 #include "chrome/common/notification_source.h"
31 #include "chrome/common/notification_type.h" 30 #include "chrome/common/notification_type.h"
32 #include "chrome/common/pref_names.h" 31 #include "chrome/common/pref_names.h"
33 #include "gfx/canvas.h" 32 #include "gfx/canvas.h"
34 #include "gfx/canvas_skia.h" 33 #include "gfx/canvas_skia.h"
35 #include "grit/app_resources.h" 34 #include "grit/app_resources.h"
36 #include "grit/generated_resources.h" 35 #include "grit/generated_resources.h"
37 #include "third_party/skia/include/core/SkBitmap.h" 36 #include "third_party/skia/include/core/SkBitmap.h"
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 // other words: ContainerMinSize() < width() - resize < ClampTo(MAX). 604 // other words: ContainerMinSize() < width() - resize < ClampTo(MAX).
606 int width = std::max(ContainerMinSize(), 605 int width = std::max(ContainerMinSize(),
607 container_size_.width() - resize_amount_); 606 container_size_.width() - resize_amount_);
608 int max_width = ClampToNearestIconCount(-1, false); // -1 gives max width. 607 int max_width = ClampToNearestIconCount(-1, false); // -1 gives max width.
609 width = std::min(width, max_width); 608 width = std::min(width, max_width);
610 609
611 return gfx::Size(width, kButtonSize); 610 return gfx::Size(width, kButtonSize);
612 } 611 }
613 612
614 void BrowserActionsContainer::Layout() { 613 void BrowserActionsContainer::Layout() {
615 // The parent can be visible, but collapsed. In this case we don't 614 if (browser_action_views_.size() == 0) {
616 // want the browser action container to be visible.
617 ToolbarView* parent = reinterpret_cast<ToolbarView*>(GetParent());
618
619 if (browser_action_views_.size() == 0 || parent->collapsed()) {
620 SetVisible(false); 615 SetVisible(false);
621 resize_gripper_->SetVisible(false); 616 resize_gripper_->SetVisible(false);
622 chevron_->SetVisible(false); 617 chevron_->SetVisible(false);
623 return; 618 return;
624 } else { 619 } else {
625 SetVisible(true); 620 SetVisible(true);
626 resize_gripper_->SetVisible(true); 621 resize_gripper_->SetVisible(true);
627 } 622 }
628 623
629 int x = 0; 624 int x = 0;
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 popup_ = NULL; 1157 popup_ = NULL;
1163 popup_button_->SetButtonNotPushed(); 1158 popup_button_->SetButtonNotPushed();
1164 popup_button_ = NULL; 1159 popup_button_ = NULL;
1165 } 1160 }
1166 1161
1167 bool BrowserActionsContainer::ShouldDisplayBrowserAction(Extension* extension) { 1162 bool BrowserActionsContainer::ShouldDisplayBrowserAction(Extension* extension) {
1168 // Only display incognito-enabled extensions while in incognito mode. 1163 // Only display incognito-enabled extensions while in incognito mode.
1169 return (!profile_->IsOffTheRecord() || 1164 return (!profile_->IsOffTheRecord() ||
1170 profile_->GetExtensionsService()->IsIncognitoEnabled(extension)); 1165 profile_->GetExtensionsService()->IsIncognitoEnabled(extension));
1171 } 1166 }
OLDNEW
« no previous file with comments | « chrome/browser/views/bookmark_bar_view.cc ('k') | chrome/browser/views/frame/browser_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698