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

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

Issue 415001: Merge 32335... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/249/src/
Patch Set: Created 11 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/extension_host.cc ('k') | chrome/browser/views/browser_bubble_win.cc » ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/gfx/canvas.h" 7 #include "app/gfx/canvas.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "chrome/browser/extensions/extension_browser_event_router.h" 11 #include "chrome/browser/extensions/extension_browser_event_router.h"
12 #include "chrome/browser/extensions/extensions_service.h" 12 #include "chrome/browser/extensions/extensions_service.h"
13 #include "chrome/browser/extensions/extension_tabs_module.h" 13 #include "chrome/browser/extensions/extension_tabs_module.h"
14 #include "chrome/browser/renderer_host/render_widget_host_view.h"
14 #include "chrome/browser/profile.h" 15 #include "chrome/browser/profile.h"
15 #include "chrome/browser/view_ids.h" 16 #include "chrome/browser/view_ids.h"
16 #include "chrome/browser/views/extensions/extension_popup.h" 17 #include "chrome/browser/views/extensions/extension_popup.h"
17 #include "chrome/browser/views/toolbar_view.h" 18 #include "chrome/browser/views/toolbar_view.h"
18 #include "chrome/common/notification_source.h" 19 #include "chrome/common/notification_source.h"
19 #include "chrome/common/notification_type.h" 20 #include "chrome/common/notification_type.h"
20 #include "grit/app_resources.h" 21 #include "grit/app_resources.h"
21 #include "third_party/skia/include/core/SkBitmap.h" 22 #include "third_party/skia/include/core/SkBitmap.h"
22 #include "third_party/skia/include/core/SkTypeface.h" 23 #include "third_party/skia/include/core/SkTypeface.h"
23 #include "third_party/skia/include/effects/SkGradientShader.h" 24 #include "third_party/skia/include/effects/SkGradientShader.h"
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 445
445 void BrowserActionsContainer::BubbleBrowserWindowMoved(BrowserBubble* bubble) { 446 void BrowserActionsContainer::BubbleBrowserWindowMoved(BrowserBubble* bubble) {
446 } 447 }
447 448
448 void BrowserActionsContainer::BubbleBrowserWindowClosing( 449 void BrowserActionsContainer::BubbleBrowserWindowClosing(
449 BrowserBubble* bubble) { 450 BrowserBubble* bubble) {
450 HidePopup(); 451 HidePopup();
451 } 452 }
452 453
453 void BrowserActionsContainer::BubbleGotFocus(BrowserBubble* bubble) { 454 void BrowserActionsContainer::BubbleGotFocus(BrowserBubble* bubble) {
455 if (!popup_)
456 return;
457
458 // Forward the focus to the renderer.
459 popup_->host()->render_view_host()->view()->Focus();
454 } 460 }
455 461
456 void BrowserActionsContainer::BubbleLostFocus(BrowserBubble* bubble) { 462 void BrowserActionsContainer::BubbleLostFocus(BrowserBubble* bubble) {
457 if (!popup_) 463 if (!popup_)
458 return; 464 return;
459 465
460 // This is a bit annoying. If you click on the button that generated the 466 // This is a bit annoying. If you click on the button that generated the
461 // current popup, then we first get this lost focus message, and then 467 // current popup, then we first get this lost focus message, and then
462 // we get the click action. This results in the popup being immediately 468 // we get the click action. This results in the popup being immediately
463 // shown again. To workaround this, we put in a delay. 469 // shown again. To workaround this, we put in a delay.
(...skipping 10 matching lines...) Expand all
474 std::min(static_cast<int>(browser_action_views_.size()), 480 std::min(static_cast<int>(browser_action_views_.size()),
475 kMinimumNumberOfVisibleBrowserActions) * kButtonSize; 481 kMinimumNumberOfVisibleBrowserActions) * kButtonSize;
476 482
477 // Even if available_width is <= 0, we still return at least the |min_width|. 483 // Even if available_width is <= 0, we still return at least the |min_width|.
478 if (available_width <= 0) 484 if (available_width <= 0)
479 return min_width; 485 return min_width;
480 486
481 return std::max(min_width, available_width - available_width % kButtonSize + 487 return std::max(min_width, available_width - available_width % kButtonSize +
482 kHorizontalPadding * 2); 488 kHorizontalPadding * 2);
483 } 489 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_host.cc ('k') | chrome/browser/views/browser_bubble_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698