| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 "content/browser/webui/generic_handler.h" | 5 #include "content/browser/webui/generic_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "content/public/browser/web_ui.h" | 11 #include "content/public/browser/web_ui.h" |
| 12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
| 13 #include "ui/base/window_open_disposition.h" | 13 #include "ui/base/window_open_disposition.h" |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 | 16 |
| 17 GenericHandler::GenericHandler() { | 17 GenericHandler::GenericHandler() { |
| 18 } | 18 } |
| 19 | 19 |
| 20 GenericHandler::~GenericHandler() { | 20 GenericHandler::~GenericHandler() { |
| 21 } | 21 } |
| 22 | 22 |
| 23 void GenericHandler::RegisterMessages() { | 23 void GenericHandler::RegisterMessages() { |
| 24 web_ui()->RegisterMessageCallback("navigateToUrl", | 24 web_ui()->RegisterMessageCallback("navigateToUrl", |
| 25 base::Bind(&GenericHandler::HandleNavigateToUrl, base::Unretained(this))); | 25 base::Bind(&GenericHandler::HandleNavigateToUrl, base::Unretained(this))); |
| 26 } | 26 } |
| 27 | 27 |
| 28 void GenericHandler::HandleNavigateToUrl(const ListValue* args) { | 28 void GenericHandler::HandleNavigateToUrl(const base::ListValue* args) { |
| 29 std::string url_string; | 29 std::string url_string; |
| 30 std::string target_string; | 30 std::string target_string; |
| 31 double button; | 31 double button; |
| 32 bool alt_key; | 32 bool alt_key; |
| 33 bool ctrl_key; | 33 bool ctrl_key; |
| 34 bool meta_key; | 34 bool meta_key; |
| 35 bool shift_key; | 35 bool shift_key; |
| 36 | 36 |
| 37 CHECK(args->GetString(0, &url_string)); | 37 CHECK(args->GetString(0, &url_string)); |
| 38 CHECK(args->GetString(1, &target_string)); | 38 CHECK(args->GetString(1, &target_string)); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 50 if (disposition == CURRENT_TAB && target_string == "_blank") | 50 if (disposition == CURRENT_TAB && target_string == "_blank") |
| 51 disposition = NEW_FOREGROUND_TAB; | 51 disposition = NEW_FOREGROUND_TAB; |
| 52 | 52 |
| 53 web_ui()->GetWebContents()->OpenURL(OpenURLParams( | 53 web_ui()->GetWebContents()->OpenURL(OpenURLParams( |
| 54 GURL(url_string), Referrer(), disposition, PAGE_TRANSITION_LINK, false)); | 54 GURL(url_string), Referrer(), disposition, PAGE_TRANSITION_LINK, false)); |
| 55 | 55 |
| 56 // This may delete us! | 56 // This may delete us! |
| 57 } | 57 } |
| 58 | 58 |
| 59 } // namespace content | 59 } // namespace content |
| OLD | NEW |