OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <algorithm> | 5 #include <algorithm> |
6 #include <set> | 6 #include <set> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 public: | 58 public: |
59 explicit NavEntryCommittedObserver(content::WebContents* web_contents) { | 59 explicit NavEntryCommittedObserver(content::WebContents* web_contents) { |
60 registrar_.Add(this, | 60 registrar_.Add(this, |
61 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 61 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
62 content::Source<content::NavigationController>( | 62 content::Source<content::NavigationController>( |
63 &web_contents->GetController())); | 63 &web_contents->GetController())); |
64 } | 64 } |
65 | 65 |
66 virtual void Observe(int type, | 66 virtual void Observe(int type, |
67 const content::NotificationSource& source, | 67 const content::NotificationSource& source, |
68 const content::NotificationDetails& details) OVERRIDE { | 68 const content::NotificationDetails& details) override { |
69 DCHECK(type == content::NOTIFICATION_NAV_ENTRY_COMMITTED); | 69 DCHECK(type == content::NOTIFICATION_NAV_ENTRY_COMMITTED); |
70 details_ = | 70 details_ = |
71 *(content::Details<content::LoadCommittedDetails>(details).ptr()); | 71 *(content::Details<content::LoadCommittedDetails>(details).ptr()); |
72 } | 72 } |
73 | 73 |
74 const content::LoadCommittedDetails& load_committed_details() const { | 74 const content::LoadCommittedDetails& load_committed_details() const { |
75 return details_; | 75 return details_; |
76 } | 76 } |
77 | 77 |
78 private: | 78 private: |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 }; | 366 }; |
367 | 367 |
368 class MockTranslateBubbleFactory : public TranslateBubbleFactory { | 368 class MockTranslateBubbleFactory : public TranslateBubbleFactory { |
369 public: | 369 public: |
370 MockTranslateBubbleFactory() {} | 370 MockTranslateBubbleFactory() {} |
371 | 371 |
372 virtual void ShowImplementation( | 372 virtual void ShowImplementation( |
373 BrowserWindow* window, | 373 BrowserWindow* window, |
374 content::WebContents* web_contents, | 374 content::WebContents* web_contents, |
375 translate::TranslateStep step, | 375 translate::TranslateStep step, |
376 translate::TranslateErrors::Type error_type) OVERRIDE { | 376 translate::TranslateErrors::Type error_type) override { |
377 if (model_) { | 377 if (model_) { |
378 model_->SetViewState( | 378 model_->SetViewState( |
379 TranslateBubbleModelImpl::TranslateStepToViewState(step)); | 379 TranslateBubbleModelImpl::TranslateStepToViewState(step)); |
380 return; | 380 return; |
381 } | 381 } |
382 | 382 |
383 ChromeTranslateClient* chrome_translate_client = | 383 ChromeTranslateClient* chrome_translate_client = |
384 ChromeTranslateClient::FromWebContents(web_contents); | 384 ChromeTranslateClient::FromWebContents(web_contents); |
385 std::string source_language = | 385 std::string source_language = |
386 chrome_translate_client->GetLanguageState().original_language(); | 386 chrome_translate_client->GetLanguageState().original_language(); |
(...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1671 menu->ExecuteCommand(IDC_CONTENT_CONTEXT_TRANSLATE, 0); | 1671 menu->ExecuteCommand(IDC_CONTENT_CONTEXT_TRANSLATE, 0); |
1672 | 1672 |
1673 // Check the bubble exists instead of the infobar. | 1673 // Check the bubble exists instead of the infobar. |
1674 translate::TranslateInfoBarDelegate* infobar = GetTranslateInfoBar(); | 1674 translate::TranslateInfoBarDelegate* infobar = GetTranslateInfoBar(); |
1675 ASSERT_TRUE(infobar == NULL); | 1675 ASSERT_TRUE(infobar == NULL); |
1676 TranslateBubbleModel* bubble = factory->model(); | 1676 TranslateBubbleModel* bubble = factory->model(); |
1677 ASSERT_TRUE(bubble != NULL); | 1677 ASSERT_TRUE(bubble != NULL); |
1678 EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_TRANSLATING, | 1678 EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_TRANSLATING, |
1679 bubble->GetViewState()); | 1679 bubble->GetViewState()); |
1680 } | 1680 } |
OLD | NEW |