Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/dom_ui/generic_handler.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "base/values.h" | |
| 9 #include "chrome/browser/tab_contents/tab_contents.h" | |
| 10 #include "googleurl/src/gurl.h" | |
| 11 | |
| 12 GenericHandler::GenericHandler() { | |
| 13 } | |
| 14 | |
| 15 GenericHandler::~GenericHandler() { | |
| 16 } | |
| 17 | |
| 18 void GenericHandler::RegisterMessages() { | |
| 19 dom_ui_->RegisterMessageCallback("navigateToUrl", | |
| 20 NewCallback(this, &GenericHandler::HandleNavigateToUrl)); | |
| 21 } | |
| 22 | |
| 23 void GenericHandler::HandleNavigateToUrl(const ListValue* args) { | |
| 24 std::string url_string; | |
| 25 CHECK(args->GetString(0, &url_string)); | |
| 26 std::string button_string; | |
| 27 CHECK(args->GetString(1, &button_string)); | |
| 28 | |
| 29 WindowOpenDisposition disposition; | |
|
arv (Not doing code reviews)
2011/01/21 23:07:32
Can you also include things like shiftKey, ctrlKey
| |
| 30 if (button_string == "1") { | |
| 31 disposition = NEW_BACKGROUND_TAB; | |
| 32 } else { | |
| 33 CHECK(button_string == "0"); | |
| 34 disposition = CURRENT_TAB; | |
| 35 } | |
| 36 | |
| 37 dom_ui_->tab_contents()->OpenURL( | |
| 38 GURL(url_string), GURL(), disposition, PageTransition::LINK); | |
| 39 | |
| 40 // This may delete us! | |
| 41 } | |
| OLD | NEW |