| 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" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 CHECK(button == 0.0 || button == 1.0); | 51 CHECK(button == 0.0 || button == 1.0); |
| 52 bool middle_button = (button == 1.0); | 52 bool middle_button = (button == 1.0); |
| 53 | 53 |
| 54 WindowOpenDisposition disposition = | 54 WindowOpenDisposition disposition = |
| 55 disposition_utils::DispositionFromClick(middle_button, alt_key, ctrl_key, | 55 disposition_utils::DispositionFromClick(middle_button, alt_key, ctrl_key, |
| 56 meta_key, shift_key); | 56 meta_key, shift_key); |
| 57 if (disposition == CURRENT_TAB && target_string == "_blank") | 57 if (disposition == CURRENT_TAB && target_string == "_blank") |
| 58 disposition = NEW_FOREGROUND_TAB; | 58 disposition = NEW_FOREGROUND_TAB; |
| 59 | 59 |
| 60 web_ui_->tab_contents()->OpenURL( | 60 web_ui_->tab_contents()->OpenURL( |
| 61 GURL(url_string), GURL(), disposition, PageTransition::LINK); | 61 GURL(url_string), GURL(), disposition, content::PAGE_TRANSITION_LINK); |
| 62 | 62 |
| 63 // This may delete us! | 63 // This may delete us! |
| 64 } | 64 } |
| 65 | 65 |
| 66 void GenericHandler::HandleSetIsLoading(const base::ListValue* args) { | 66 void GenericHandler::HandleSetIsLoading(const base::ListValue* args) { |
| 67 CHECK(args->GetSize() == 1); | 67 CHECK(args->GetSize() == 1); |
| 68 std::string is_loading; | 68 std::string is_loading; |
| 69 CHECK(args->GetString(0, &is_loading)); | 69 CHECK(args->GetString(0, &is_loading)); |
| 70 | 70 |
| 71 SetIsLoading(is_loading == "true"); | 71 SetIsLoading(is_loading == "true"); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void GenericHandler::SetIsLoading(bool is_loading) { | 74 void GenericHandler::SetIsLoading(bool is_loading) { |
| 75 DCHECK(web_ui_); | 75 DCHECK(web_ui_); |
| 76 | 76 |
| 77 TabContents* contents = web_ui_->tab_contents(); | 77 TabContents* contents = web_ui_->tab_contents(); |
| 78 bool was_loading = contents->IsLoading(); | 78 bool was_loading = contents->IsLoading(); |
| 79 | 79 |
| 80 is_loading_ = is_loading; | 80 is_loading_ = is_loading; |
| 81 if (was_loading != contents->IsLoading()) | 81 if (was_loading != contents->IsLoading()) |
| 82 contents->delegate()->LoadingStateChanged(contents); | 82 contents->delegate()->LoadingStateChanged(contents); |
| 83 } | 83 } |
| OLD | NEW |