| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/dom_ui/textfields_ui.h" | 5 #include "chrome/browser/dom_ui/textfields_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/singleton.h" | 10 #include "base/singleton.h" |
| 11 #include "base/string_piece.h" | 11 #include "base/string_piece.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "chrome/browser/browser_thread.h" | 13 #include "chrome/browser/browser_thread.h" |
| 14 #include "chrome/browser/profiles/profile.h" | |
| 15 #include "chrome/browser/tab_contents/tab_contents.h" | |
| 16 #include "chrome/common/jstemplate_builder.h" | 14 #include "chrome/common/jstemplate_builder.h" |
| 17 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
| 18 #include "grit/browser_resources.h" | 16 #include "grit/browser_resources.h" |
| 19 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
| 20 | 18 |
| 21 /** | 19 /** |
| 22 * TextfieldsUIHTMLSource implementation. | 20 * TextfieldsUIHTMLSource implementation. |
| 23 */ | 21 */ |
| 24 TextfieldsUIHTMLSource::TextfieldsUIHTMLSource() | 22 TextfieldsUIHTMLSource::TextfieldsUIHTMLSource() |
| 25 : DataSource(chrome::kChromeUITextfieldsHost, MessageLoop::current()) { | 23 : DataSource(chrome::kChromeUITextfieldsHost, MessageLoop::current()) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 * TextfieldsUI implementation. | 61 * TextfieldsUI implementation. |
| 64 */ | 62 */ |
| 65 TextfieldsUI::TextfieldsUI(TabContents* contents) : DOMUI(contents) { | 63 TextfieldsUI::TextfieldsUI(TabContents* contents) : DOMUI(contents) { |
| 66 TextfieldsDOMHandler* handler = new TextfieldsDOMHandler(); | 64 TextfieldsDOMHandler* handler = new TextfieldsDOMHandler(); |
| 67 AddMessageHandler(handler); | 65 AddMessageHandler(handler); |
| 68 handler->Attach(this); | 66 handler->Attach(this); |
| 69 | 67 |
| 70 TextfieldsUIHTMLSource* html_source = new TextfieldsUIHTMLSource(); | 68 TextfieldsUIHTMLSource* html_source = new TextfieldsUIHTMLSource(); |
| 71 | 69 |
| 72 // Set up the chrome://textfields/ source. | 70 // Set up the chrome://textfields/ source. |
| 73 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); | 71 BrowserThread::PostTask( |
| 72 BrowserThread::IO, FROM_HERE, |
| 73 NewRunnableMethod(ChromeURLDataManager::GetInstance(), |
| 74 &ChromeURLDataManager::AddDataSource, |
| 75 make_scoped_refptr(html_source))); |
| 74 } | 76 } |
| OLD | NEW |