OLD | NEW |
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_win.h" | 5 #include "chrome/browser/autocomplete/autocomplete_edit_view_win.h" |
6 | 6 |
7 #include <locale> | 7 #include <locale> |
8 | 8 |
9 #include "app/clipboard/clipboard.h" | 9 #include "app/clipboard/clipboard.h" |
10 #include "app/clipboard/scoped_clipboard_writer.h" | 10 #include "app/clipboard/scoped_clipboard_writer.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "skia/ext/skia_utils_win.h" | 44 #include "skia/ext/skia_utils_win.h" |
45 #include "views/drag_utils.h" | 45 #include "views/drag_utils.h" |
46 #include "views/focus/focus_util_win.h" | 46 #include "views/focus/focus_util_win.h" |
47 #include "views/widget/widget.h" | 47 #include "views/widget/widget.h" |
48 | 48 |
49 #pragma comment(lib, "oleacc.lib") // Needed for accessibility support. | 49 #pragma comment(lib, "oleacc.lib") // Needed for accessibility support. |
50 | 50 |
51 /////////////////////////////////////////////////////////////////////////////// | 51 /////////////////////////////////////////////////////////////////////////////// |
52 // AutocompleteEditModel | 52 // AutocompleteEditModel |
53 | 53 |
54 // A single AutocompleteController used solely for making synchronous calls to | |
55 // determine how to deal with the clipboard contents for Paste And Go | |
56 // functionality. We avoid using the popup's controller here because we don't | |
57 // want to interrupt in-progress queries or modify the popup state just | |
58 // because the user right-clicked the edit. We don't need a controller for | |
59 // every edit because this will always be accessed on the main thread, so we | |
60 // won't have thread-safety problems. | |
61 static AutocompleteController* paste_and_go_controller = NULL; | |
62 static int paste_and_go_controller_refcount = 0; | |
63 | |
64 namespace { | 54 namespace { |
65 | 55 |
66 // EditDropTarget is the IDropTarget implementation installed on | 56 // EditDropTarget is the IDropTarget implementation installed on |
67 // AutocompleteEditViewWin. EditDropTarget prefers URL over plain text. A drop | 57 // AutocompleteEditViewWin. EditDropTarget prefers URL over plain text. A drop |
68 // of a URL replaces all the text of the edit and navigates immediately to the | 58 // of a URL replaces all the text of the edit and navigates immediately to the |
69 // URL. A drop of plain text from the same edit either copies or moves the | 59 // URL. A drop of plain text from the same edit either copies or moves the |
70 // selected text, and a drop of plain text from a source other than the edit | 60 // selected text, and a drop of plain text from a source other than the edit |
71 // does a paste and go. | 61 // does a paste and go. |
72 class EditDropTarget : public BaseDropTarget { | 62 class EditDropTarget : public BaseDropTarget { |
73 public: | 63 public: |
(...skipping 2324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2398 context_menu_contents_->AddItemWithStringId(IDS_PASTE_AND_GO, | 2388 context_menu_contents_->AddItemWithStringId(IDS_PASTE_AND_GO, |
2399 IDS_PASTE_AND_GO); | 2389 IDS_PASTE_AND_GO); |
2400 context_menu_contents_->AddSeparator(); | 2390 context_menu_contents_->AddSeparator(); |
2401 context_menu_contents_->AddItemWithStringId(IDS_SELECT_ALL, IDS_SELECT_ALL); | 2391 context_menu_contents_->AddItemWithStringId(IDS_SELECT_ALL, IDS_SELECT_ALL); |
2402 context_menu_contents_->AddSeparator(); | 2392 context_menu_contents_->AddSeparator(); |
2403 context_menu_contents_->AddItemWithStringId(IDS_EDIT_SEARCH_ENGINES, | 2393 context_menu_contents_->AddItemWithStringId(IDS_EDIT_SEARCH_ENGINES, |
2404 IDS_EDIT_SEARCH_ENGINES); | 2394 IDS_EDIT_SEARCH_ENGINES); |
2405 } | 2395 } |
2406 context_menu_.reset(new views::Menu2(context_menu_contents_.get())); | 2396 context_menu_.reset(new views::Menu2(context_menu_contents_.get())); |
2407 } | 2397 } |
OLD | NEW |