OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <io.h> | 5 #include <io.h> |
6 | 6 |
7 #include "chrome/browser/spellchecker.h" | 7 #include "chrome/browser/spellchecker.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/histogram.h" | 10 #include "base/histogram.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "chrome/common/l10n_util.h" | 23 #include "chrome/common/l10n_util.h" |
24 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
25 #include "chrome/common/pref_service.h" | 25 #include "chrome/common/pref_service.h" |
26 #include "chrome/common/render_messages.h" | 26 #include "chrome/common/render_messages.h" |
27 #include "chrome/common/win_util.h" | 27 #include "chrome/common/win_util.h" |
28 #include "chrome/third_party/hunspell/src/hunspell/hunspell.hxx" | 28 #include "chrome/third_party/hunspell/src/hunspell/hunspell.hxx" |
29 #include "net/url_request/url_request.h" | 29 #include "net/url_request/url_request.h" |
30 | 30 |
31 #include "generated_resources.h" | 31 #include "generated_resources.h" |
32 | 32 |
| 33 using base::TimeTicks; |
| 34 |
33 static const int kMaxSuggestions = 5; // Max number of dictionary suggestions. | 35 static const int kMaxSuggestions = 5; // Max number of dictionary suggestions. |
34 | 36 |
35 // This is a helper class which acts as a proxy for invoking a task from the | 37 // This is a helper class which acts as a proxy for invoking a task from the |
36 // file loop back to the IO loop. Invoking a task from file loop to the IO | 38 // file loop back to the IO loop. Invoking a task from file loop to the IO |
37 // loop directly is not safe as during browser shutdown, the IO loop tears | 39 // loop directly is not safe as during browser shutdown, the IO loop tears |
38 // down before the file loop. To avoid a crash, this object is invoked in the | 40 // down before the file loop. To avoid a crash, this object is invoked in the |
39 // UI loop from the file loop, from where it gets the IO thread directly from | 41 // UI loop from the file loop, from where it gets the IO thread directly from |
40 // g_browser_process and invokes the given task in the IO loop if it is not | 42 // g_browser_process and invokes the given task in the IO loop if it is not |
41 // NULL. This object also takes ownership of the given task. | 43 // NULL. This object also takes ownership of the given task. |
42 class UIProxyForIOTask : public Task { | 44 class UIProxyForIOTask : public Task { |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 // Now add the word to the custom dictionary file in the file loop. | 533 // Now add the word to the custom dictionary file in the file loop. |
532 if (file_loop_) { | 534 if (file_loop_) { |
533 file_loop_->PostTask(FROM_HERE, new AddWordToCustomDictionaryTask( | 535 file_loop_->PostTask(FROM_HERE, new AddWordToCustomDictionaryTask( |
534 custom_dictionary_file_name_, word)); | 536 custom_dictionary_file_name_, word)); |
535 } else { // just run it in this thread. | 537 } else { // just run it in this thread. |
536 Task* write_word_task = new AddWordToCustomDictionaryTask( | 538 Task* write_word_task = new AddWordToCustomDictionaryTask( |
537 custom_dictionary_file_name_, word); | 539 custom_dictionary_file_name_, word); |
538 write_word_task->Run(); | 540 write_word_task->Run(); |
539 } | 541 } |
540 } | 542 } |
OLD | NEW |