| 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/chromeos/dom_ui/menu_ui.h" | 5 #include "chrome/browser/chromeos/dom_ui/menu_ui.h" |
| 6 | 6 |
| 7 #include "app/menus/menu_model.h" | 7 #include "app/menus/menu_model.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 // | 528 // |
| 529 //////////////////////////////////////////////////////////////////////////////// | 529 //////////////////////////////////////////////////////////////////////////////// |
| 530 | 530 |
| 531 MenuUI::MenuUI(TabContents* contents) : DOMUI(contents) { | 531 MenuUI::MenuUI(TabContents* contents) : DOMUI(contents) { |
| 532 MenuHandler* handler = new MenuHandler(); | 532 MenuHandler* handler = new MenuHandler(); |
| 533 AddMessageHandler((handler)->Attach(this)); | 533 AddMessageHandler((handler)->Attach(this)); |
| 534 | 534 |
| 535 BrowserThread::PostTask( | 535 BrowserThread::PostTask( |
| 536 BrowserThread::IO, FROM_HERE, | 536 BrowserThread::IO, FROM_HERE, |
| 537 NewRunnableMethod( | 537 NewRunnableMethod( |
| 538 Singleton<ChromeURLDataManager>::get(), | 538 ChromeURLDataManager::GetInstance(), |
| 539 &ChromeURLDataManager::AddDataSource, | 539 &ChromeURLDataManager::AddDataSource, |
| 540 make_scoped_refptr(CreateDataSource()))); | 540 make_scoped_refptr(CreateDataSource()))); |
| 541 } | 541 } |
| 542 | 542 |
| 543 MenuUI::MenuUI(TabContents* contents, ChromeURLDataManager::DataSource* source) | 543 MenuUI::MenuUI(TabContents* contents, ChromeURLDataManager::DataSource* source) |
| 544 : DOMUI(contents) { | 544 : DOMUI(contents) { |
| 545 MenuHandler* handler = new MenuHandler(); | 545 MenuHandler* handler = new MenuHandler(); |
| 546 AddMessageHandler((handler)->Attach(this)); | 546 AddMessageHandler((handler)->Attach(this)); |
| 547 | 547 |
| 548 BrowserThread::PostTask( | 548 BrowserThread::PostTask( |
| 549 BrowserThread::IO, FROM_HERE, | 549 BrowserThread::IO, FROM_HERE, |
| 550 NewRunnableMethod( | 550 NewRunnableMethod( |
| 551 Singleton<ChromeURLDataManager>::get(), | 551 ChromeURLDataManager::GetInstance(), |
| 552 &ChromeURLDataManager::AddDataSource, | 552 &ChromeURLDataManager::AddDataSource, |
| 553 make_scoped_refptr(source))); | 553 make_scoped_refptr(source))); |
| 554 } | 554 } |
| 555 | 555 |
| 556 void MenuUI::ModelUpdated(const menus::MenuModel* model) { | 556 void MenuUI::ModelUpdated(const menus::MenuModel* model) { |
| 557 DictionaryValue json_model; | 557 DictionaryValue json_model; |
| 558 ListValue* items = new ListValue(); | 558 ListValue* items = new ListValue(); |
| 559 json_model.Set("items", items); | 559 json_model.Set("items", items); |
| 560 int max_icon_width = 0; | 560 int max_icon_width = 0; |
| 561 bool has_accelerator = false; | 561 bool has_accelerator = false; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 | 655 |
| 656 ChromeURLDataManager::DataSource* MenuUI::CreateDataSource() { | 656 ChromeURLDataManager::DataSource* MenuUI::CreateDataSource() { |
| 657 return CreateMenuUIHTMLSource(NULL, | 657 return CreateMenuUIHTMLSource(NULL, |
| 658 chrome::kChromeUIMenu, | 658 chrome::kChromeUIMenu, |
| 659 "Menu" /* class name */, | 659 "Menu" /* class name */, |
| 660 kNoExtraResource, | 660 kNoExtraResource, |
| 661 kNoExtraResource); | 661 kNoExtraResource); |
| 662 } | 662 } |
| 663 | 663 |
| 664 } // namespace chromeos | 664 } // namespace chromeos |
| OLD | NEW |