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

Side by Side Diff: chrome/browser/cocoa/location_bar_view_mac.mm

Issue 515027: Fixes bug where a Page Action icon was not being properly displayed upon page... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Second upload to get try server. Created 11 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/cocoa/location_bar_view_mac.h ('k') | no next file » | 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 #import "chrome/browser/cocoa/location_bar_view_mac.h" 5 #import "chrome/browser/cocoa/location_bar_view_mac.h"
6 6
7 #include "app/l10n_util_mac.h" 7 #include "app/l10n_util_mac.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"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 field_(field), 92 field_(field),
93 disposition_(CURRENT_TAB), 93 disposition_(CURRENT_TAB),
94 security_image_view_(profile, toolbar_model), 94 security_image_view_(profile, toolbar_model),
95 page_action_views_(new PageActionViewList(this, profile, toolbar_model)), 95 page_action_views_(new PageActionViewList(this, profile, toolbar_model)),
96 profile_(profile), 96 profile_(profile),
97 toolbar_model_(toolbar_model), 97 toolbar_model_(toolbar_model),
98 transition_(PageTransition::TYPED) { 98 transition_(PageTransition::TYPED) {
99 AutocompleteTextFieldCell* cell = [field_ autocompleteTextFieldCell]; 99 AutocompleteTextFieldCell* cell = [field_ autocompleteTextFieldCell];
100 [cell setSecurityImageView:&security_image_view_]; 100 [cell setSecurityImageView:&security_image_view_];
101 [cell setPageActionViewList:page_action_views_]; 101 [cell setPageActionViewList:page_action_views_];
102
103 registrar_.Add(this,
104 NotificationType::EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED,
105 NotificationService::AllSources());
102 } 106 }
103 107
104 LocationBarViewMac::~LocationBarViewMac() { 108 LocationBarViewMac::~LocationBarViewMac() {
105 // TODO(shess): Placeholder for omnibox changes. 109 // TODO(shess): Placeholder for omnibox changes.
106 delete page_action_views_; 110 delete page_action_views_;
107 } 111 }
108 112
109 std::wstring LocationBarViewMac::GetInputString() const { 113 std::wstring LocationBarViewMac::GetInputString() const {
110 return location_input_; 114 return location_input_;
111 } 115 }
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 security_image_view_.SetVisible(false); 394 security_image_view_.SetVisible(false);
391 break; 395 break;
392 default: 396 default:
393 NOTREACHED(); 397 NOTREACHED();
394 security_image_view_.SetVisible(false); 398 security_image_view_.SetVisible(false);
395 break; 399 break;
396 } 400 }
397 [field_ resetFieldEditorFrameIfNeeded]; 401 [field_ resetFieldEditorFrameIfNeeded];
398 } 402 }
399 403
404 void LocationBarViewMac::Observe(NotificationType type,
405 const NotificationSource& source,
406 const NotificationDetails& details) {
407 switch (type.value) {
408 case NotificationType::EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED: {
409 TabContents* contents =
410 BrowserList::GetLastActive()->GetSelectedTabContents();
411 if (Details<TabContents>(contents) != details)
412 return;
413
414 [field_ setNeedsDisplay:YES];
415 break;
416 }
417 default:
418 NOTREACHED() << "Unexpected notification";
419 break;
420 }
421 }
422
400 // LocationBarImageView--------------------------------------------------------- 423 // LocationBarImageView---------------------------------------------------------
401 424
402 void LocationBarViewMac::LocationBarImageView::SetImage(NSImage* image) { 425 void LocationBarViewMac::LocationBarImageView::SetImage(NSImage* image) {
403 image_.reset([image retain]); 426 image_.reset([image retain]);
404 } 427 }
405 428
406 void LocationBarViewMac::LocationBarImageView::SetImage(SkBitmap* image) { 429 void LocationBarViewMac::LocationBarImageView::SetImage(SkBitmap* image) {
407 SetImage(gfx::SkBitmapToNSImage(*image)); 430 SetImage(gfx::SkBitmapToNSImage(*image));
408 } 431 }
409 432
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 if (views_[i]->IsVisible()) 745 if (views_[i]->IsVisible())
723 ++result; 746 ++result;
724 } 747 }
725 return result; 748 return result;
726 } 749 }
727 750
728 void LocationBarViewMac::PageActionViewList::OnMousePressed(NSRect iconFrame, 751 void LocationBarViewMac::PageActionViewList::OnMousePressed(NSRect iconFrame,
729 size_t index) { 752 size_t index) {
730 ViewAt(index)->OnMousePressed(iconFrame); 753 ViewAt(index)->OnMousePressed(iconFrame);
731 } 754 }
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/location_bar_view_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698