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

Side by Side Diff: chrome/browser/autocomplete/autocomplete_edit_view_mac.mm

Issue 222020: [Mac] Show the page info window after clicking the security icon in the URL bar (Closed)
Patch Set: Unit tests Created 11 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 (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/autocomplete/autocomplete_edit_view_mac.h" 5 #include "chrome/browser/autocomplete/autocomplete_edit_view_mac.h"
6 6
7 #include <Carbon/Carbon.h> // kVK_Return 7 #include <Carbon/Carbon.h> // kVK_Return
8 8
9 #include "app/clipboard/clipboard.h" 9 #include "app/clipboard/clipboard.h"
10 #include "app/gfx/font.h" 10 #include "app/gfx/font.h"
11 #include "app/l10n_util_mac.h" 11 #include "app/l10n_util_mac.h"
12 #include "app/resource_bundle.h" 12 #include "app/resource_bundle.h"
13 #import "base/cocoa_protocols_mac.h" 13 #import "base/cocoa_protocols_mac.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/sys_string_conversions.h" 15 #include "base/sys_string_conversions.h"
16 #include "chrome/browser/autocomplete/autocomplete_edit.h" 16 #include "chrome/browser/autocomplete/autocomplete_edit.h"
17 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" 17 #include "chrome/browser/autocomplete/autocomplete_popup_model.h"
18 #include "chrome/browser/autocomplete/autocomplete_popup_view_mac.h" 18 #include "chrome/browser/autocomplete/autocomplete_popup_view_mac.h"
19 #include "chrome/browser/browser_list.h"
19 #include "chrome/browser/browser_process.h" 20 #include "chrome/browser/browser_process.h"
20 #include "chrome/browser/cocoa/event_utils.h" 21 #include "chrome/browser/cocoa/event_utils.h"
22 #include "chrome/browser/tab_contents/navigation_entry.h"
21 #include "chrome/browser/tab_contents/tab_contents.h" 23 #include "chrome/browser/tab_contents/tab_contents.h"
22 #include "grit/generated_resources.h" 24 #include "grit/generated_resources.h"
23 25
24 // Focus-handling between |field_| and |model_| is a bit subtle. 26 // Focus-handling between |field_| and |model_| is a bit subtle.
25 // Other platforms detect change of focus, which is inconvenient 27 // Other platforms detect change of focus, which is inconvenient
26 // without subclassing NSTextField (even with a subclass, the use of a 28 // without subclassing NSTextField (even with a subclass, the use of a
27 // field editor may complicate things). 29 // field editor may complicate things).
28 // 30 //
29 // |model_| doesn't actually do anything when it gains focus, it just 31 // |model_| doesn't actually do anything when it gains focus, it just
30 // initializes. Visible activity happens only after the user edits. 32 // initializes. Visible activity happens only after the user edits.
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 [editor replaceCharactersInRange:selectedRange withString:s]; 629 [editor replaceCharactersInRange:selectedRange withString:s];
628 [editor didChangeText]; 630 [editor didChangeText];
629 } 631 }
630 } 632 }
631 633
632 bool AutocompleteEditViewMac::CanPasteAndGo() { 634 bool AutocompleteEditViewMac::CanPasteAndGo() {
633 return 635 return
634 model_->CanPasteAndGo(GetClipboardText(g_browser_process->clipboard())); 636 model_->CanPasteAndGo(GetClipboardText(g_browser_process->clipboard()));
635 } 637 }
636 638
639 void AutocompleteEditViewMac::OnSecurityIconClicked() {
640 TabContents* tab = BrowserList::GetLastActive()->GetSelectedTabContents();
641 NavigationEntry* nav_entry = tab->controller().GetActiveEntry();
642 if (!nav_entry) {
643 NOTREACHED();
644 return;
645 }
646 tab->ShowPageInfo(nav_entry->url(), nav_entry->ssl(), true);
647 }
648
637 int AutocompleteEditViewMac::GetPasteActionStringId() { 649 int AutocompleteEditViewMac::GetPasteActionStringId() {
638 DCHECK(CanPasteAndGo()); 650 DCHECK(CanPasteAndGo());
639 651
640 // Use PASTE_AND_SEARCH as the default fallback (although the DCHECK above 652 // Use PASTE_AND_SEARCH as the default fallback (although the DCHECK above
641 // should never trigger). 653 // should never trigger).
642 if (!model_->is_paste_and_search()) 654 if (!model_->is_paste_and_search())
643 return IDS_PASTE_AND_GO; 655 return IDS_PASTE_AND_GO;
644 else 656 else
645 return IDS_PASTE_AND_SEARCH; 657 return IDS_PASTE_AND_SEARCH;
646 } 658 }
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 // TODO(shess): Figure out where the selection belongs. On GTK, 882 // TODO(shess): Figure out where the selection belongs. On GTK,
871 // it's set to the start of the text. 883 // it's set to the start of the text.
872 } 884 }
873 885
874 // Signal that we've lost focus when the window resigns key. 886 // Signal that we've lost focus when the window resigns key.
875 - (void)windowDidResignKey:(NSNotification*)notification { 887 - (void)windowDidResignKey:(NSNotification*)notification {
876 edit_view_->OnDidResignKey(); 888 edit_view_->OnDidResignKey();
877 } 889 }
878 890
879 @end 891 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698